Files
frontend-app/pages/mine_order_info/mine_order_info.vue
T

558 lines
16 KiB
Vue
Raw Normal View History

2025-03-20 08:46:07 +08:00
<template>
2025-05-07 09:54:33 +08:00
<view
class="mine_order_info_warp"
:style="{
'height': 'calc(100vh - '+height+')'
}"
>
<up-loading-page :loading="listLoading"></up-loading-page>
2025-03-20 08:46:07 +08:00
<view class="order_info_header">
<up-image src="/static/common/left_b.png" width="20" height="19" bgColor="#f1f6ff00" @click="jumpLeft"></up-image>
<view class="header_status">
2025-05-07 09:54:33 +08:00
<view style="margin-top: 10rpx;">
<up-image src="/static/common/order_status_1.png" width="20" height="19" bgColor="#f1f6ff00"></up-image>
</view>
2025-03-20 08:46:07 +08:00
<text class="msg">{{getValue(ORDER_STATUS,orderInfo.status)}}</text>
</view>
</view>
<view class="order_info_content">
<!-- 等待付款 -->
<view class="content_due" v-if="orderInfo.status === ORDER_TYPE.UNPAID">
<view style="">
<text style="font-size: 28rpx;font-weight: bold;">需付款:</text>
<text style="font-size: 28rpx;">¥</text>
2025-05-07 09:54:33 +08:00
<text style="font-size: 36rpx;font-weight: bold;">{{orderInfo.sumAmount}}</text>
<!-- <text style="font-size: 28rpx;">.00</text> -->
<text style="font-size: 20rpx;font-weight: bold;margin-left: 20rpx;">订单</text>
<text style="font-size: 28rpx;font-weight: bold;margin-left: 10rpx;">{{formatDate1(orderInfo.expireTime)}}</text>
<text style="font-size: 20rpx;font-weight: bold;">&nbsp;自动取消</text>
2025-03-20 08:46:07 +08:00
</view>
2025-05-07 09:54:33 +08:00
<!-- <view class="payment_but">
2025-03-20 08:46:07 +08:00
<view class="but">去支付</view>
2025-05-07 09:54:33 +08:00
</view> -->
2025-03-20 08:46:07 +08:00
</view>
<view class="content_cancel" v-if="orderInfo.status === ORDER_TYPE.CANCELED">取消原因:超时未支付</view>
<!-- 地址 -->
<view class="steps_warp">
<!-- 物流单号 -->
2025-05-07 09:54:33 +08:00
<view class="address_info">
2025-03-20 08:46:07 +08:00
<view class="address_data_warp">
<up-image src="/static/common/waybill.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
2025-05-07 09:54:33 +08:00
<view class="address_info_name">订单编号:</view>
<view class="address_info_mobile" style="margin-right: 20rpx;">{{orderInfo.orderNum}}</view>
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(orderInfo.orderNum)"></up-image>
2025-03-20 08:46:07 +08:00
</view>
</view>
2025-05-07 09:54:33 +08:00
<view class="address_info_right">&nbsp;</view>
2025-03-20 08:46:07 +08:00
<!-- 收货地址 -->
<view class="address_warp">
<view class="address_info">
<view class="address_data_warp">
<up-image src="/static/common/address.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
<view class="address_info_name">{{orderInfo.name}}</view>
2025-05-07 09:54:33 +08:00
<view class="address_info_mobile">{{orderInfo.phone}}</view>
2025-03-20 08:46:07 +08:00
</view>
2025-05-07 09:54:33 +08:00
<!-- <view class="address_but">修改地址</view> -->
2025-03-20 08:46:07 +08:00
</view>
<view class="address_content">
2025-05-07 09:54:33 +08:00
{{assembleAddress(orderInfo).names}} {{orderInfo.address}}
2025-03-20 08:46:07 +08:00
</view>
</view>
</view>
<!-- 产品 -->
<view class="order_comm order_product_warp">
<!-- 头部 -->
<view class="order_product_header">
2025-05-07 09:54:33 +08:00
<up-image :src="orderInfo.shopLogo" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{orderInfo.shopName}}</view>
2025-03-20 08:46:07 +08:00
</view>
<!-- 产品详情 -->
<view class="order_item_content">
2025-05-07 09:54:33 +08:00
<view v-for="pItem in orderInfo.items" :key="pItem.id" >
<view 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" :key="dItem">
{{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>
2025-03-20 08:46:07 +08:00
</view>
</view>
2025-05-07 09:54:33 +08:00
<view class="content_other_item">
<view class="data_item data_item_yd" v-if="pItem.expressNo">
<view class="item_title">运单号:</view>
<view class="item_value">
<view>{{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>
2025-03-20 08:46:07 +08:00
</view>
</view>
</view>
2025-05-07 09:54:33 +08:00
2025-03-20 08:46:07 +08:00
</view>
<!-- 金额等数据汇总 -->
<view class="order_comm order_data_warp">
<view class="data_item">
<view class="item_title">商品总价</view>
2025-05-07 09:54:33 +08:00
<view class="item_value">¥{{orderInfo.sumAmount}}</view>
2025-03-20 08:46:07 +08:00
</view>
<view class="data_item">
<view class="item_title">快递运费</view>
<view class="item_value">¥0.00</view>
</view>
<view class="data_item">
2025-05-07 09:54:33 +08:00
<view class="item_title">平台优惠<text class="copy_order_coupon" v-if="orderInfo.coupon">优惠券</text></view>
<view class="item_value">-¥0.00</view>
2025-03-20 08:46:07 +08:00
</view>
<view class="data_item">
<view class="item_title">应付款</view>
2025-05-07 09:54:33 +08:00
<view class="item_value pay_amount">¥{{orderInfo.sumAmount}}</view>
2025-03-20 08:46:07 +08:00
</view>
<view class="order_data_but"></view>
2025-05-07 09:54:33 +08:00
2025-03-20 08:46:07 +08:00
<view class="data_item">
<view class="item_title">买家留言</view>
2025-05-07 09:54:33 +08:00
<view class="item_value">{{orderInfo.remark}}</view>
2025-03-20 08:46:07 +08:00
</view>
<view class="data_item">
<view class="item_title">配送方式</view>
<view class="item_value">普通快递</view>
</view>
2025-05-07 09:54:33 +08:00
<!-- <view class="data_item">
2025-03-20 08:46:07 +08:00
<view class="item_title">支付方式</view>
<view class="item_value">微信支付</view>
2025-05-07 09:54:33 +08:00
</view> -->
2025-03-20 08:46:07 +08:00
<view class="data_item">
<view class="item_title">下单时间</view>
2025-05-07 09:54:33 +08:00
<view class="item_value">{{formatDate(orderInfo.ctdate)}}</view>
</view>
</view>
<!-- 支付方式 -->
<view class="order_way_warp" @click="wayShow = true;" v-if="orderInfo.status === ORDER_TYPE.UNPAID">
<view>支付方式</view>
<view class="order_way_right">
{{getValue(wayOption,wayForm.payway)}}
<up-image src="/static/common/right.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
2025-03-20 08:46:07 +08:00
</view>
</view>
</view>
2025-05-07 09:54:33 +08:00
<view
class="collect_operate order_but_warp"
v-if="[ORDER_TYPE.UNPAID,ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status)"
>
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">取消订单</view> -->
2025-03-20 08:46:07 +08:00
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.UNPAID" @click="goPay">去付款</view>
2025-05-07 09:54:33 +08:00
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE" @click="confirmReceiptOk(orderInfo)">确认收货</view>
<!-- <view class="operate_comm operate_but_3" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">提醒发货</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="[ORDER_TYPE.COMPLETED].includes(orderInfo.status)">删除记录</view> -->
<!-- <view class="operate_comm operate_but_3" v-if="[ORDER_TYPE.COMPLETED,ORDER_TYPE.CANCELED].includes(orderInfo.status)">再次购买</view> -->
2025-03-20 08:46:07 +08:00
</view>
2025-05-07 09:54:33 +08:00
<!-- 选择支付方式 -->
<up-popup v-model:show="wayShow" :round="10" :closeOnClickOverlay="false" :closeable="true" :safeAreaInsetBottom="false">
<view class="way_popup_warp">
<view class="way_popup_title">支付方式</view>
<up-radio-group
v-model="wayForm.payway"
placement="column"
>
<view class="way_item" v-for="item in wayOption" :key="item.type">
<view class="way_item_">
<!-- <view style="margin-top: 2rpx;"><up-image :src="item.path" width="20" height="20" bgColor="#f1f6ff00"></up-image></view> -->
<view class="way_item_val">{{item.name}}<text v-if="item.balance">&nbsp;&nbsp;({{item.balance}})</text></view>
</view>
<up-radio
:name="item.type"
activeColor="#FF7C41"
>
</up-radio>
</view>
</up-radio-group>
<view class="popup_but" @click="wayShow = false;">
确认
</view>
</view>
</up-popup>
<up-toast ref="uToastRef"></up-toast>
2025-03-20 08:46:07 +08:00
</view>
</template>
<script>
import { ORDER_TYPE,ORDER_STATUS,getValue } from '@/utils/enumUtils.js';
2025-05-07 09:54:33 +08:00
import { copyData,assembleAddress,formatDate,formatDate1 } from '@/utils/index.js';
import { getDetail,payment,getSupportPay,confirmReceipt } from '@/api/order.js';
import { appWxpayFun,zfbPayFun,jumpWayOk,jumpWayError } from '@/utils/payUtils.js'
2025-03-20 08:46:07 +08:00
export default {
computed: {
ORDER_TYPE() {
2025-05-07 09:54:33 +08:00
return ORDER_TYPE;
2025-03-20 08:46:07 +08:00
},
ORDER_STATUS() {
2025-05-07 09:54:33 +08:00
return ORDER_STATUS;
2025-03-20 08:46:07 +08:00
},
ORDER_STATUS_CSS() {
2025-05-07 09:54:33 +08:00
return ORDER_STATUS_CSS;
},
2025-03-20 08:46:07 +08:00
},
data() {
return {
2025-05-07 09:54:33 +08:00
id:0,
orderInfo:{},
listLoading:false,
wayForm:{
id:0,
payway:null,// 支付方式
2025-03-20 08:46:07 +08:00
},
2025-05-07 09:54:33 +08:00
wayShow:false,
wayOption:[],// 支付选项
height:'180rpx',
2025-03-20 08:46:07 +08:00
}
},
onLoad(options) {
2025-05-07 09:54:33 +08:00
const id = options.id;
this.id = id ? parseInt(id,10) : 0;
this.getOrderInfo();
this.getWayOption();
2025-03-20 08:46:07 +08:00
},
methods: {
getValue,
copyData,
2025-05-07 09:54:33 +08:00
assembleAddress,
formatDate,
formatDate1,
2025-03-20 08:46:07 +08:00
jumpLeft(){
uni.navigateTo({
2025-05-07 09:54:33 +08:00
url:"/pages/mine_order/mine_order?type="+this.orderInfo.status,
2025-03-20 08:46:07 +08:00
})
},
2025-05-07 09:54:33 +08:00
async getWayOption(){
const result = await getSupportPay();
if(result && result.bizcode === 100){
this.wayOption = result.data;
}
},
// 查询订单详情
async getOrderInfo(){
this.listLoading = true;
const params={
id:this.id,
}
const result = await getDetail(params);
if(result && result.bizcode === 100){
const orderInfo = result.data;
if([ORDER_TYPE.UNPAID,ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status)){
this.height = '180rpx';
}else{
this.height = '0rpx';
}
this.orderInfo = orderInfo;
}
this.listLoading = false;
},
2025-03-20 08:46:07 +08:00
// 去支付
2025-05-07 09:54:33 +08:00
async goPay(){
const payway = this.wayForm.payway;
if(!payway || payway === 0){
this.$refs.uToastRef.show({
type: 'error',
message: "请先选择支付方式",
});
return;
}
const params={
id:this.orderInfo.id,
payway,
}
const resp = await payment(params);
// 提交订单成功,就唤起支付
if(resp && resp.bizcode === 100){
const item = resp.data;
if(item.status === 1){
jumpWayOk();
return;
}
if(item.wechat && Object.keys(item.wechat).length !==0){
this.appWxpay(item.wechat,item.orderId,item.orderNum);
}else if(item.alipay && Object.keys(item.alipay).length !==0 && item.alipay){
this.zfbPay(item.alipay,item.orderId,item.orderNum);
}else{
this.$refs.uToastRef.show({
type: 'error',
message: "订单支付失败",
});
setTimeout(()=>{
jumpWayError()
},2000)
}
}else{
this.getOrderInfo();
}
},
// app 微信支付
async appWxpay(alipay,orderId,orderNum){
try {
const result = await appWxpayFun(alipay,orderId,orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
// 支付宝支付
async zfbPay(alipay,orderId,orderNum){
try {
const result = await zfbPayFun(alipay,orderId,orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
/**
* 确认收货
*/
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();
}
2025-03-20 08:46:07 +08:00
}
}
}
</script>
<style lang="scss" scoped>
.mine_order_info_warp{
2025-05-07 09:54:33 +08:00
// height: calc(100vh - 180rpx);
2025-03-20 08:46:07 +08:00
background-color: $app-bj;
position: relative;
overflow-y: auto;
}
.order_info_header{
background-color: $app-bt-bj;
height: 288rpx;
display: flex;
padding: 100rpx 30rpx 30rpx;
.header_status{
width: 90%;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
height: 58rpx;
align-items: center;
.msg{
margin-left: 20rpx;
font-weight: bold;
font-size: 36rpx;
color: #FFFFFF;
}
}
}
.order_info_content{
position: absolute;
top: 184rpx;
2025-05-07 09:54:33 +08:00
width: calc(100% - 40rpx);
2025-03-20 08:46:07 +08:00
padding: 0 20rpx;
.content_due{
display: grid;
justify-content: center;
width: 100%;
color: #FFFFFF;
.payment_but{
display: flex;
justify-content: center;
}
.but{
background: #FFFFFF;
border-radius: 16rpx;
text-align: center;
width: 200rpx;
padding: 10rpx 0;
color: $app-bt-bj;
font-weight: bold;
font-size: 28rpx;
margin-top: 20rpx;
}
}
.content_cancel{
text-align: center;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
}
.steps_warp{
background: #FFFFFF;
border-radius: 24rpx;
padding: 20rpx;
2025-05-07 09:54:33 +08:00
width: calc(100% - 40rpx);
2025-03-20 08:46:07 +08:00
margin-top: 66rpx;
.address_info_right{
border-left: 1rpx dashed #99999959;
2025-05-07 09:54:33 +08:00
height: 14rpx;
2025-03-20 08:46:07 +08:00
width: 10rpx;
2025-05-07 09:54:33 +08:00
margin: 10rpx 20rpx;
2025-03-20 08:46:07 +08:00
}
.address_warp{
}
.address_info{
display: flex;
justify-content: space-between;
}
.address_data_warp{
font-weight: bold;
color: #1A1A1A;
display: flex;
align-items: center;
}
.address_info_name{
margin-left: 10rpx;
font-size: 28rpx;
}
.address_info_mobile{
margin-left: 10rpx;
font-size: 24rpx;
}
.address_but{
border-radius: 30rpx;
border: 1px solid #9A9A9A;
font-size: 20rpx;
color: #222222;
padding: 8rpx 20rpx;
}
.address_content{
font-weight: 500;
font-size: 26rpx;
color: #666666;
padding: 20rpx 10rpx 20rpx 44rpx;
}
}
}
.order_comm{
background: #FFFFFF;
border-radius: 20rpx;
padding: 30rpx;
margin-top: 30rpx;
2025-05-07 09:54:33 +08:00
width: calc(100% - 60rpx);
2025-03-20 08:46:07 +08:00
}
.order_product_warp{
.order_product_header{
display: flex;
2025-05-07 09:54:33 +08:00
align-items: center;
2025-03-20 08:46:07 +08:00
}
.order_product_title{
font-weight: bold;
font-size: 28rpx;
color: #1A1A1A;
margin-left: 10rpx;
}
}
.order_data_warp{
margin-bottom: 20rpx;
2025-05-07 09:54:33 +08:00
2025-03-20 08:46:07 +08:00
.pay_amount{
color: $app-bt-bj;
}
.copy_order_number{
background: #F2F2F2;
border-radius: 18rpx;
font-weight: bold;
font-size: 22rpx;
color: #333333;
padding: 4rpx 14rpx;
margin-left: 10rpx;
}
.copy_order_coupon{
margin-left: 24rpx;
border-radius: 6rpx;
border: 1px solid $app-bt-bj;
padding: 4rpx 18rpx;
color: $app-bt-bj;
}
.order_data_but{
border: 1rpx solid #F6F6F6;
}
}
.order_but_warp{
position: fixed;
height: 140rpx;
bottom: 0;
background-color: #ffffff;
right: 14rpx;
width: calc(100% - 40rpx);
background-color: #ffffff;
padding: 20rpx;
.operate_comm{
height: 34rpx;
}
}
2025-05-07 09:54:33 +08:00
.content_other_item{
margin-top: 20rpx;
}
.data_item{
display: flex;
justify-content: space-between;
line-height: 60rpx;
font-weight: bold;
font-size: 24rpx;
}
.item_title{
color: #808080;
}
.item_value{
color: #1A1A1A;
display: flex;
}
.order_way_warp{
margin-bottom: 60rpx;
width: calc(100% - 60rpx);
}
.content_info_title{
width: 370rpx;
}
.data_item_yd{
display: flex;
justify-content: left;
}
2025-03-20 08:46:07 +08:00
</style>