@ -10,7 +10,7 @@
订单编号
< / view >
< view class = "r" >
wx23556151561321321351213
{ { state . orderInfo . no } }
< / view >
< / view >
< view class = "ddxx" >
@ -18,7 +18,7 @@
兑换时间
< / view >
< view class = "r" >
2024 - 10 - 18 15 : 46 : 03
{ { sheep . $helper . timeFormat ( state . orderInfo . createTime , 'yyyy-mm-dd hh:MM:ss' ) } }
< / view >
< / view >
< view class = "ddxx" >
@ -31,71 +31,212 @@
< / view >
< view class = "ddxx" >
< view class = "l" >
支付 方式
支付 积分
< / view >
< view class = "r" >
10
{ { state . orderInfo . usePoint } }
< / view >
< / view >
< view class = "fgx" > < / view >
< view class = "ck-detail" >
< view class = "ck-detail" @click ="sheep.$router.redirect('/pages/activity/point/exchange_detail',{id:state.id})" >
查看详情
< / view >
< view class = "bk-home" >
< view class = "bk-home" @click ="sheep.$router.redirect('/pages/index/index');" >
返回首页
< / view >
< / view >
< / s - l a y o u t >
< / template >
< script setup >
import sheep from '@/sheep' ;
import { onLoad , onReachBottom } from '@dcloudio/uni-app' ;
import { reactive , ref } from 'vue' ;
import PointApi from '@/sheep/api/promotion/point' ;
import SLayout from '@/sheep/components/s-layout/s-layout.vue' ;
import sheep from '@/sheep' ;
import {
onLoad
} from '@dcloudio/uni-app' ;
import {
reactive ,
ref
} from 'vue' ;
import {
isEmpty
} from 'lodash-es' ;
import {
fen2yuan ,
formatOrderStatus ,
formatOrderStatusDescription ,
handleOrderButtons ,
} from '@/sheep/hooks/useGoods' ;
import OrderApi from '@/sheep/api/trade/order' ;
import DeliveryApi from '@/sheep/api/trade/delivery' ;
import PickUpVerify from '@/pages/order/pickUpVerify.vue' ;
/ / 计 算 页 面 高 度
const { safeAreaInsets , safeArea } = sheep . $platform . device ;
const statusBarHeight = sheep . $platform . device . statusBarHeight * 2 ;
const pageHeight =
( safeArea . height + safeAreaInsets . bottom ) * 2 + statusBarHeight - sheep . $platform . navbar - 350 ;
const statusBarHeight = sheep . $platform . device . statusBarHeight * 2 ;
const headerBg = sheep . $url . css ( '/static/img/shop/order/order_bg.png' ) ;
const sPointCardRef = ref ( ) ;
/ / 查 询 活 动 列 表
const activityPageParams = reactive ( {
pageNo : 1 , / / 页 码
pageSize : 5 , / / 每 页 数 量
} ) ;
const state = reactive ( {
orderInfo : { } ,
merchantTradeNo : '' , / / 商 户 订 单 号
comeinType : '' , / / 进 入 订 单 详 情 的 来 源 类 型
id : 0
} ) ;
const activityTotal = ref ( 0 ) ; / / 活 动 总 数
const activityCount = ref ( 0 ) ; / / 已 加 载 活 动 数 量
const loadStatus = ref ( '' ) ; / / 页 面 加 载 状 态
async function getActivityList ( ) {
loadStatus . value = 'loading' ;
const { data } = await PointApi . getPointActivityPage ( activityPageParams ) ;
await sPointCardRef . value . concatActivity ( data . list ) ;
activityCount . value = sPointCardRef . value . getActivityCount ( ) ;
activityTotal . value = data . total ;
/ / = = = = = = = = = = 门 店 自 提 ( 核 销 ) = = = = = = = = = =
const systemStore = ref ( { } ) ; / / 门 店 信 息
loadStatus . value = activityCount . value < activityTotal . value ? 'more' : 'noMore' ;
}
/ / 复 制
const onCopy = ( ) => {
sheep . $helper . copyText ( state . orderInfo . no ) ;
} ;
/ / 加 载 更 多
function loadMore ( ) {
if ( state . loadStatus !== 'noMore' ) {
activityPageParams . pageNo += 1 ;
getActivityList ( ) ;
}
}
/ / 去 支 付
function onPay ( payOrderId ) {
sheep . $router . go ( '/pages/pay/index' , {
id : payOrderId ,
} ) ;
}
/ / 上 拉 加 载 更 多
onReachBottom ( ( ) => {
loadMore ( ) ;
} ) ;
onLoad ( ( ) => {
getActivityList ( ) ;
} ) ;
/ / 查 看 商 品
function onGoodsDetail ( id ) {
sheep . $router . go ( '/pages/goods/index' , {
id ,
} ) ;
}
/ / 取 消 订 单
async function onCancel ( orderId ) {
uni . showModal ( {
title : '提示' ,
content : '确定要取消订单吗?' ,
success : async function ( res ) {
if ( ! res . confirm ) {
return ;
}
const {
code
} = await OrderApi . cancelOrder ( orderId ) ;
if ( code === 0 ) {
await getOrderDetail ( orderId ) ;
}
} ,
} ) ;
}
/ / 查 看 物 流
async function onExpress ( id ) {
sheep . $router . go ( '/pages/order/express/log' , {
id ,
} ) ;
}
/ / 确 认 收 货 T O D O 芋 艿 : 待 测 试
async function onConfirm ( orderId , ignore = false ) {
/ / 需 开 启 确 认 收 货 组 件
/ / t o d o : 芋 艿 : 待 接 入 微 信
/ / 1 . 怎 么 检 测 是 否 开 启 了 发 货 组 件 功 能 ? 如 果 没 有 开 启 的 话 就 不 能 在 这 里 r e t u r n 出 去
/ / 2 . 如 果 开 启 了 走 m p C o n f i r m 方 法 , 需 要 在 A p p . v u e 的 s h o w 方 法 中 拿 到 确 认 收 货 结 果
let isOpenBusinessView = true ;
if (
sheep . $platform . name === 'WechatMiniProgram' &&
! isEmpty ( state . orderInfo . wechat _extra _data ) &&
isOpenBusinessView &&
! ignore
) {
mpConfirm ( orderId ) ;
return ;
}
/ / 正 常 的 确 认 收 货 流 程
const {
code
} = await OrderApi . receiveOrder ( orderId ) ;
if ( code === 0 ) {
await getOrderDetail ( orderId ) ;
}
}
/ / # i f d e f M P - W E I X I N
/ / 小 程 序 确 认 收 货 组 件
function mpConfirm ( orderId ) {
if ( ! wx . openBusinessView ) {
sheep . $helper . toast ( ` 请升级微信版本 ` ) ;
return ;
}
wx . openBusinessView ( {
businessType : 'weappOrderConfirm' ,
extraData : {
merchant _trade _no : state . orderInfo . wechat _extra _data . merchant _trade _no ,
transaction _id : state . orderInfo . wechat _extra _data . transaction _id ,
} ,
success ( response ) {
console . log ( 'success:' , response ) ;
if ( response . errMsg === 'openBusinessView:ok' ) {
if ( response . extraData . status === 'success' ) {
onConfirm ( orderId , true ) ;
}
}
} ,
fail ( error ) {
console . log ( 'error:' , error ) ;
} ,
complete ( result ) {
console . log ( 'result:' , result ) ;
} ,
} ) ;
}
/ / # e n d i f
/ / 评 价
function onComment ( id ) {
sheep . $router . go ( '/pages/goods/comment/add' , {
id ,
} ) ;
}
const pickUpVerifyRef = ref ( ) ;
async function getOrderDetail ( id ) {
/ / 对 详 情 数 据 进 行 适 配
let res ;
if ( state . comeinType === 'wechat' ) {
/ / T O D O 芋 艿 : 微 信 场 景 下
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 ) ;
/ / 配 送 方 式 : 门 店 自 提
if ( res . data . pickUpStoreId ) {
const {
data
} = await DeliveryApi . getDeliveryPickUpStore ( res . data . pickUpStoreId ) ;
systemStore . value = data || { } ;
}
if ( state . orderInfo . deliveryType === 2 && state . orderInfo . payStatus ) {
pickUpVerifyRef . value && pickUpVerifyRef . value . markCode ( res . data . pickUpVerifyCode ) ;
}
} else {
sheep . $router . back ( ) ;
}
}
onLoad ( async ( options ) => {
let id = 0 ;
if ( options . id ) {
id = options . id ;
state . id = options . id ;
}
/ / T O D O 芋 艿 : 下 面 两 个 变 量 , 后 续 接 入
state . comeinType = options . comein _type ;
if ( state . comeinType === 'wechat' ) {
state . merchantTradeNo = options . merchant _trade _no ;
}
await getOrderDetail ( id ) ;
} ) ;
< / script >
< style lang = "scss" scope >