Refactor(订单):订单列表和详情状态值判断重构

This commit is contained in:
lifizer
2025-08-21 15:47:33 +08:00
parent 881a1e1477
commit 810cf318aa
3 changed files with 376 additions and 248 deletions
+291 -177
View File
@@ -1,7 +1,15 @@
<template> <template>
<view class="my-order v12-mx-2" ref="container" @click="handleBody"> <view class="my-order v12-mx-2" ref="container" @click="handleBody">
<view class="m-search-wrap v12-mb-2 v12-mt-3"> <view class="m-search-wrap v12-mb-2 v12-mt-3">
<u-search placeholder="请输入商品名/订单号" shape="round" :inputStyle="inputStyle" :showAction="false" bgColor="#FFF" v-model="keyword" @search="changeType"></u-search> <u-search
v-model="keyword"
:inputStyle="inputStyle"
:showAction="false"
placeholder="请输入商品名/订单号"
shape="round"
bgColor="#FFF"
@search="changeType"
/>
</view> </view>
<view class="m-tab-warp"> <view class="m-tab-warp">
<u-tabs <u-tabs
@@ -11,49 +19,79 @@
:inactiveStyle="inactiveStyle" :inactiveStyle="inactiveStyle"
:current="type" :current="type"
:list="tabList" :list="tabList"
@click="tabChange"> @click="tabChange"
</u-tabs> />
</view> </view>
<!-- <u-tabs lineColor="#FF564A" activeStyle="#FF564A" inactiveStyle="#C2C5CC" :current="type" :list="tabList"
@click="tabChange"></u-tabs> -->
<view class="list v12-ma-0" style="padding: 0rpx 0 30rpx;"> <view class="list v12-ma-0" style="padding: 0rpx 0 30rpx;">
<view class="item" v-for="(order,orderListIndex) in orderList" :key="orderListIndex"> <view
<view class="shop-info flex jc-between ai-center" v-if="order.merName" @click="goStore(order)"> v-for="(order, orderListIndex) in orderList"
:key="orderListIndex"
class="item"
>
<view
v-if="order.merName"
class="shop-info flex jc-between ai-center"
@click="goStore(order)"
>
<view class="flex ai-center"> <view class="flex ai-center">
<image :src="webUrl+'/orderIcon/shop.png'" style="width: 32rpx;height: 32rpx"/> <image
:src="webUrl+'/orderIcon/shop.png'"
style="width: 32rpx;height: 32rpx"
/>
<text class="name v12-font-weight-400 v12-dark-text v12-font-24">{{ order.merName }}</text> <text class="name v12-font-weight-400 v12-dark-text v12-font-24">{{ order.merName }}</text>
<image :src="webUrl+'/orderIcon/arrow.png'" style="width: 24rpx;height: 24rpx; margin-top: 5rpx"/> <image
:src="webUrl+'/orderIcon/arrow.png'"
style="width: 24rpx;height: 24rpx; margin-top: 5rpx"
/>
</view> </view>
<view class="flex ai-center"> <view class="flex ai-center">
<image :src="webUrl+'/orderIcon/map.png'" style="width: 28rpx;height: 28rpx"/> <image
:src="webUrl+'/orderIcon/map.png'"
style="width: 28rpx;height: 28rpx"
/>
<text class="address v12-dark-text v12-font-bold v12-font-24">{{ order.merCityName }}</text> <text class="address v12-dark-text v12-font-bold v12-font-24">{{ order.merCityName }}</text>
</view> </view>
</view> </view>
<view class="title acea-row row-between-wrapper" style="padding: 0 0 0 30rpx !important;"> <view class="title acea-row row-between-wrapper" style="padding: 0 0 0 30rpx !important;">
<view class="acea-row row-middle"> <view class="acea-row row-middle">
<span class="sign cart-color acea-row row-center-wrapper v12-priamry-text v12-priamry-border v12-radius-40" v-if="order.combinationId > 0">拼团</span> <text
<span class="sign cart-color acea-row row-center-wrapper v12-priamry-text v12-priamry-border v12-radius-40" v-if="order.seckillId > 0">秒杀</span> v-if="order.combinationId || order.seckillId || order.bargainId || order.storeId"
<span class="sign cart-color acea-row row-center-wrapper v12-priamry-text v12-priamry-border v12-radius-40" v-if="order.bargainId > 0">砍价</span> class="sign cart-color acea-row row-center-wrapper v12-priamry-text v12-priamry-border v12-radius-40"
<span class="sign cart-color acea-row row-center-wrapper v12-priamry-text v12-priamry-border v12-radius-40" v-if="order.storeId > 0">门店</span> >
<text v-if="order.combinationId > 0">拼团</text>
<text v-if="order.seckillId > 0">秒杀</text>
<text v-if="order.bargainId > 0">砍价</text>
<text v-if="order.storeId > 0">门店</text>
</text>
订单号:{{ order.orderId }} 订单号:{{ order.orderId }}
</view> </view>
<view class="font-color-white statusTag v12-primary" v-if="order.isTickets===1 && order._status._type === 1"> <view
v-if="order.isTickets === 1 && parseInt(order._status._type) === 1"
class="font-color-white statusTag v12-primary"
>
待核销 待核销
</view> </view>
<view class="font-color-white statusTag v12-primary" v-else>{{ order.isGiftCardSend || order.isGiftCardReceive ? '礼包' :getStatus(order) }}</view> <view
v-else
class="font-color-white statusTag v12-primary"
>{{ (order.isGiftCardSend || order.isGiftCardReceive) ? '礼包' : getStatus(order) }}</view>
</view> </view>
<view @click="goOrderDetails(order)"> <view @click="goOrderDetails(order)">
<view class="item-info acea-row row-between row-top" v-if="order.isGiftCardReceiveBlind === 1"> <view
v-if="order.isGiftCardReceiveBlind === 1"
class="item-info acea-row row-between row-top"
>
<view class="pictrue"> <view class="pictrue">
<image <image
:src="webUrl+'/orderIcon/盲盒礼包.png'" :src="webUrl+'/orderIcon/盲盒礼包.png'"
/> />
</view> </view>
</view> </view>
<view class="item-info acea-row row-between row-top" v-for="(cart,cartInfoIndex) in order.cartInfo" <view
:key="cartInfoIndex"> v-for="(cart,cartInfoIndex) in order.cartInfo"
:key="cartInfoIndex"
class="item-info acea-row row-between row-top"
>
<view class="pictrue"> <view class="pictrue">
<image <image
v-if="cart.combinationId === 0 && cart.bargainId === 0 &&cart.seckillId === 0" v-if="cart.combinationId === 0 && cart.bargainId === 0 &&cart.seckillId === 0"
@@ -99,66 +137,121 @@
</view> </view>
</view> </view>
<view class="totalPrice acea-row row-between row-middle"> <view class="totalPrice acea-row row-between row-middle">
<view class="" v-if="order.createTime"><span class="orderTime v12-font-24 v12-dark1-text">{{ order.createTime }}</span></view> <view v-if="order.createTime">
<view class="v12-font-24 v12-dark1-text">{{ order.totalNum || 0 }}件商品 <span class="orderTime v12-font-24 v12-dark1-text">{{ order.createTime }}</span>
<text class="v12-dark-text v12-font-28 v12-font-bold" v-if="order.isGiftCardReceiveBlind === 0"> </view>
总金额 <view class="v12-font-24 v12-dark1-text">
{{ order.totalNum || 0 }}件商品
<text v-if="order.isGiftCardReceiveBlind === 0">
<text class="v12-dark-text v12-font-28 v12-font-bold">
总金额
</text>
<text class="v12-font-22 v12-primary-text v12-font-bold">
</text>
<text class="money font-color-lightred v12-font-28 v12-primary-text v12-font-bold">
{{ force2Decimal(order.payPrice) }}
</text>
</text> </text>
<text class="v12-font-22 v12-primary-text v12-font-bold" v-if="order.isGiftCardReceiveBlind === 0">
</text>
<text v-if="order.isGiftCardReceiveBlind === 0" class="money font-color-lightred v12-font-28 v12-primary-text v12-font-bold">{{ force2Decimal(order.payPrice) }}</text>
</view> </view>
</view> </view>
<view class="bottom flex jc-between ai-center" v-if="!order.isGiftCardSend"> <view
<view class="group-btn" v-if="!order.isGiftCardSend"
v-if="(Number(order._status._type) === 2 || Number(order._status._type) === 3) && class="bottom flex jc-between ai-center"
order.isTickets === 0"> >
<text class="btn-more v12-font-28 v12-font-bold" @click.stop="tapShowMore(order,orderListIndex)">更多</text> <view
v-if="[2, 3].includes(parseInt(order._status._type)) && order.isTickets === 0"
class="group-btn"
>
<text
class="btn-more v12-font-28 v12-font-bold"
@click.stop="tapShowMore(order, orderListIndex)"
>更多</text>
<view class="group-float" v-show="order.showMore"> <view class="group-float" v-show="order.showMore">
<view class="btn btn-service flex jc-center ai-center v12-font-24" @click="goRoom(order)" <view
v-if="order.merName && order.isGiftCardReceiveBlind === 0">联系商家 v-if="order.merName && order.isGiftCardReceiveBlind === 0"
</view> class="btn btn-service flex jc-center ai-center v12-font-24"
<view class="btn flex jc-center ai-center v12-font-24" @click="goRefund(order)">申请退款</view> @click="goRoom(order)"
>联系商家</view>
<view
class="btn flex jc-center ai-center v12-font-24"
@click="goRefund(order)"
>申请退款</view>
</view> </view>
</view> </view>
<template v-else> <template v-else>
<view class="v12-justify-between" style="width: 100%"> <view class="v12-justify-between" style="width: 100%">
<view> <view>
<view class="bnt service" @click="goRoom(order)" v-if="order.isGiftCardReceiveBlind === 0 && order.merName && order._status._type != 0 && Number(order._status._type) !== 9">联系商家</view> <view
v-if="order.isGiftCardReceiveBlind === 0 &&
order.merName &&
parseInt(order._status._type) !== 0 &&
parseInt(order._status._type) !== 9
"
class="bnt service"
@click="goRoom(order)"
>联系商家</view>
</view> </view>
<view class="v12-justify-between"> <view class="v12-justify-between">
<view class="bnt service" @click="goOrderDetails(order)" v-if="['-1','-2','-3'].includes(order._status._type)">查看详情</view> <view
<view class="bnt service" @click="delOrder(order)" v-if="['9'].includes(order._status._type)">删除订单</view> class="bnt service"
<!-- <view class="bnt v12-primary-text v12-primary-border" @click="takeOrder(order)" v-if="['-2','-3'].includes(order._status._type)">确认收货</view> --> @click="goOrderDetails(order)"
v-if="[-1, -2, -3].includes(parseInt(order._status._type))"
>查看详情</view>
<view
class="bnt service"
@click="delOrder(order)"
v-if="[9].includes(parseInt(order._status._type))"
>删除订单</view>
</view> </view>
</view> </view>
<!-- <view v-else></view> -->
</template> </template>
<view class="flex"> <view class="flex">
<template v-if="order._status._type == 0"> <template v-if="parseInt(order._status._type) === 0">
<view class="bnt cancelBnt v12-dark-text v12-dark-border" @click="cancelOrder(order)">取消订单</view> <view
<view class="bnt cancelBnt v12-dark-text v12-dark-border" @click="addressTap(order)">修改地址</view> class="bnt cancelBnt v12-dark-text v12-dark-border"
<view class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40" @click="subscribePay(order)">立即付款</view> @click="cancelOrder(order)"
>取消订单</view>
<view
class="bnt cancelBnt v12-dark-text v12-dark-border"
@click="addressTap(order)"
>修改地址</view>
<view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="subscribePay(order)"
>立即付款</view>
</template> </template>
<template v-if="(order._status._type == 1 ) && order.isTickets==0"> <template v-if="parseInt(order._status._type) === 1 && order.isTickets === 0">
<view class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40" @click="goOrderDetails(order)">查看详情</view> <view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="goOrderDetails(order)"
>查看详情</view>
</template> </template>
<template v-if="order._status._type == 1 && order.isTickets == 1"> <template v-if="parseInt(order._status._type) === 1 && order.isTickets === 1">
<view class="bnt bg-color-lightred" @click="goOrderDetails(order)">立即核销</view> <view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="goOrderDetails(order)"
>立即核销</view>
</template> </template>
<template v-if="order._status._type == 2 && order.isTickets == 0"> <template v-if="parseInt(order._status._type) === 2 && order.isTickets === 0">
<view class="bnt default" v-if="order.isExtendedDelivery==0" <view
@click="toDelay(order.orderId)">延长收货 v-if="order.isExtendedDelivery === 0"
class="bnt default"
@click="toDelay(order.orderId)"
>延长收货
</view> </view>
<!-- <view class="bnt default v12-radius-40" @click="goLogistics(order)">查看物流</view> --> <view
<view class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40" @click="takeOrder(order)">确认收货</view> class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="takeOrder(order)"
>确认收货</view>
</template> </template>
<template v-if="order._status._type == 3"> <template v-if="parseInt(order._status._type) === 3">
<view class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40" @click="goOrderDetails(order)">去评价</view> <view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="goOrderDetails(order)"
>去评价</view>
</template> </template>
<template v-if="order._status._type === 4"> <template v-if="parseInt(order._status._type) === 4">
<view class="bnt bg-color-lightred" @click="goOrderDetails(order)">查看订单</view> <view class="bnt bg-color-lightred" @click="goOrderDetails(order)">查看订单</view>
</template> </template>
</view> </view>
@@ -168,8 +261,11 @@
{{ Number(order.status) === 0 ? '待支付' : getGiftTips(order.giftCardInfo) }} {{ Number(order.status) === 0 ? '待支付' : getGiftTips(order.giftCardInfo) }}
</view> </view>
<view class="flex jc-between ai-center"> <view class="flex jc-between ai-center">
<view class="bnt btn-service flex jc-center ai-center v12-font-24" @click="goRoom(order)" <view
v-if="order.merName && order.isGiftCardReceiveBlind === 0">联系商家 v-if="order.merName && order.isGiftCardReceiveBlind === 0"
class="bnt btn-service flex jc-center ai-center v12-font-24"
@click="goRoom(order)"
>联系商家
</view> </view>
<view class="v12-align-center"> <view class="v12-align-center">
<button <button
@@ -188,50 +284,75 @@
class="gift-btn service v12-primary-text v12-primary-border" class="gift-btn service v12-primary-text v12-primary-border"
@click="subscribePay(order)" @click="subscribePay(order)"
>立即支付</button> >立即支付</button>
<!-- 查看详情 -->
<view class="bnt service v12-primary-text v12-primary-border" @click="goOrderDetails(order)">查看详情</view> <view class="bnt service v12-primary-text v12-primary-border" @click="goOrderDetails(order)">查看详情</view>
</view> </view>
</view> </view>
</view> </view>
<view class="v12-px-3 v12-pb-4" v-if="order._status._type == 1"> <view
<view class="v12-font-22 v12-secondary-dark-text order-tips" v-if="order.isFastPost !== 0">商家已接收您的订单,支付成功后预计{{ getTime(order.isFastPost) }}发货</view> v-if="parseInt(order._status._type) === 1 && order.isFastPost !== 0"
class="v12-px-3 v12-pb-4"
>
<view
class="v12-font-22 v12-secondary-dark-text order-tips"
>商家已接收您的订单,支付成功后预计{{ getTime(order.isFastPost) }}发货</view>
</view> </view>
</view> </view>
</view> </view>
<u-modal <u-modal
:show="showExtend" :show="showExtend"
title="确认延长收货时间?" title="确认延长收货时间?"
content='每笔订单只能延长一次哦' content='每笔订单只能延长一次哦'
showCancelButton showCancelButton
@cancel="showExtend=false" @cancel="toDelayCancel"
@confirm="doneDelay"> @confirm="doneDelay"
</u-modal> />
<view class="noCart" v-if="orderList.length === 0 && page > 1"> <view
v-if="orderList.length === 0 && page > 1"
class="noCart"
>
<view class="pictrue"> <view class="pictrue">
<image :src="webUrl+'/20240102232734472795.png'"/> <image :src="webUrl+'/20240102232734472795.png'"/>
</view> </view>
</view> </view>
<Loading :loaded="loaded" :loading="loading"></Loading> <Loading
<Payment v-model="pay" :types="payType" @checked="toPay" :balance="userInfo.nowMoney"></Payment> :loaded="loaded"
:loading="loading"
/>
<Payment
v-model="pay"
:types="payType"
:balance="userInfo.nowMoney"
@checked="toPay"
/>
<passkeyborad <passkeyborad
v-if="isShowPayPwdPop" v-if="isShowPayPwdPop"
ref='payPwdPop'
:money="orderInfo.payPrice" :money="orderInfo.payPrice"
showMoney showMoney
:show="isShowPayPwdPop" :show="isShowPayPwdPop"
ref='payPwdPop'
@close="pwdPopClose" @close="pwdPopClose"
@finish="pwdPopFinish" @finish="pwdPopFinish"
></passkeyborad> />
</view> </view>
</template> </template>
<script> <script>
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard' import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
import {getOrderData, getOrderList, orderDelay, editAddress } from "@/api/order"; import {
import {cancelOrderHandle, payOrderHandle, takeOrderHandle, yuePayOrderHandle, delOrderHandle} from "@/libs/order"; getOrderData,
import Loading from "@/components/Loading"; getOrderList,
import Payment from "@/components/Payment"; orderDelay,
import {mapGetters} from "vuex"; editAddress
} from "@/api/order"
import {
cancelOrderHandle,
payOrderHandle,
takeOrderHandle,
yuePayOrderHandle,
delOrderHandle
} from "@/libs/order"
import Loading from "@/components/Loading"
import Payment from "@/components/Payment"
import { mapGetters } from "vuex"
import { pageListenMixins } from '@/mixins/pageListenMixins' import { pageListenMixins } from '@/mixins/pageListenMixins'
export default { export default {
@@ -262,13 +383,14 @@ export default {
}, },
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
tabList: [ tabList: [
{name: '全部'}, { name: '全部' },
{name: '待付款'}, { name: '待付款' },
{name: '待发货'}, { name: '待发货' },
{name: '待收货/待核销'}, { name: '待收货/待核销' },
{name: '退款/售后'}, { name: '退款/售后' },
{name: '待评价'}, { name: '待评价' },
{name: '已完成'}], { name: '已完成' }
],
offlinePayStatus: 2, offlinePayStatus: 2,
orderData: {}, orderData: {},
type: 0, type: 0,
@@ -286,7 +408,7 @@ export default {
pageKeyId: Object.freeze('userOrderIndex'), pageKeyId: Object.freeze('userOrderIndex'),
keyword: '', keyword: '',
_orderId: '' _orderId: ''
}; }
}, },
components: { components: {
Loading, Loading,
@@ -332,13 +454,11 @@ export default {
_this._orderId = '' _this._orderId = ''
} }
}) })
} else {
} }
}, },
onLoad() { onLoad() {
this.type = this.type || parseInt(this.$yroute.query.type) || 0; this.type = this.type || parseInt(this.$yroute.query.type) || 0
this.changeType(this.type); this.changeType(this.type)
}, },
onShareAppMessage() { onShareAppMessage() {
uni.updateShareMenu({ uni.updateShareMenu({
@@ -363,8 +483,6 @@ export default {
return timeMap[type] return timeMap[type]
}, },
shareGift(item) { shareGift(item) {
console.log(item);
this.giftItem = item this.giftItem = item
}, },
getGiftTips(giftCardInfo) { getGiftTips(giftCardInfo) {
@@ -398,7 +516,6 @@ export default {
}, },
delOrder(order) { delOrder(order) {
delOrderHandle(order.orderId).then(() => { delOrderHandle(order.orderId).then(() => {
// this.goBack()
this.page = 1 this.page = 1
this.orderList = []; this.orderList = [];
this.getOrderListReq() this.getOrderListReq()
@@ -416,7 +533,7 @@ export default {
query: { query: {
id: order.hotelId id: order.hotelId
} }
}); })
}, },
async toYuePay(payPwd) { async toYuePay(payPwd) {
const that = this; const that = this;
@@ -426,19 +543,21 @@ export default {
this.payPassword = ""; this.payPassword = "";
}, },
pwdPopClose() { pwdPopClose() {
this.isShowPayPwdPop = false; this.isShowPayPwdPop = false
}, },
pwdPopFinish(payPwd) { pwdPopFinish(payPwd) {
this.payPassword = payPwd; this.payPassword = payPwd
this.toYuePay(payPwd)
this.toYuePay(payPwd); this.isShowPayPwdPop = false
this.isShowPayPwdPop = false;
}, },
subscribePay(order) { subscribePay(order) {
this.orderInfo = order this.orderInfo = order
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ['7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE', 'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU', '9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'], tmplIds: [
'7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE',
'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU',
'9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'
],
complete: () => this.pay = true complete: () => this.pay = true
}) })
}, },
@@ -449,10 +568,10 @@ export default {
query: { query: {
choosMode: 1 choosMode: 1
} }
}); })
}, },
force2Decimal(v) { force2Decimal(v) {
return this.$force2Decimal(v); return this.$force2Decimal(v)
}, },
goRoom(order) { goRoom(order) {
const params = { const params = {
@@ -509,11 +628,11 @@ export default {
}) })
}, },
setOfflinePayStatus: function (status) { setOfflinePayStatus: function (status) {
let that = this; const that = this
that.offlinePayStatus = status; that.offlinePayStatus = status
if (status === 1) { if (status === 1) {
if (that.payType.indexOf("offline") < 0) { if (that.payType.indexOf("offline") < 0) {
that.payType.push("offline"); that.payType.push("offline")
} }
} }
}, },
@@ -543,11 +662,11 @@ export default {
}, },
getOrderData() { getOrderData() {
getOrderData().then(res => { getOrderData().then(res => {
this.orderData = res.data; this.orderData = res.data
}); })
}, },
takeOrder(order) { takeOrder(order) {
let that = this; const that = this
uni.showModal({ uni.showModal({
title: '是否确认收货?', title: '是否确认收货?',
content: '', content: '',
@@ -557,32 +676,31 @@ export default {
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
takeOrderHandle(order.orderId).finally(() => { takeOrderHandle(order.orderId).finally(() => {
that.reload(); that.reload()
that.getOrderData(); that.getOrderData()
}); })
} else if (res.cancel) {
} }
} }
}); })
}, },
reload() { reload() {
this.changeType(this.type); this.changeType(this.type)
}, },
tabChange(item) { tabChange(item) {
this.type = item.index this.type = item.index
this.$yroute.query.type = this.type this.$yroute.query.type = this.type
this.changeType(); this.changeType()
}, },
changeType() { changeType() {
this.orderList = []; this.orderList = []
this.page = 1; this.page = 1
this.loaded = false; this.loaded = false
this.loading = false; this.loading = false
this.getOrderListReq(); this.getOrderListReq()
}, },
getOrderListReq() { getOrderListReq() {
if (this.loading || this.loaded) return; if (this.loading || this.loaded) return
this.loading = true; this.loading = true
const types = { const types = {
0: 0, 0: 0,
1: 1, 1: 1,
@@ -597,25 +715,24 @@ export default {
page, page,
limit, limit,
keyword keyword
} = this; } = this
getOrderList({ getOrderList({
page, page,
limit, limit,
type, type,
keyword keyword
}).then(res => { }).then(res => {
this.orderList = this.orderList.concat(res.data); this.orderList = this.orderList.concat(res.data)
if (this.orderList.length > 0) { if (this.orderList.length > 0) {
this.orderList.forEach(item => { this.orderList.forEach(item => {
item.showMore = false; item.showMore = false;
}) })
} }
this.page++; this.page++;
this.loaded = res.data.length < this.limit; this.loaded = res.data.length < this.limit
this.loading = false; this.loading = false
}).finally(() => { }).finally(() => {
this.loading = false; this.loading = false
// console.log('???',this.loading);
}); });
}, },
tapShowMore(order, index) { tapShowMore(order, index) {
@@ -623,98 +740,95 @@ export default {
this.$set(this.orderList, index, order); this.$set(this.orderList, index, order);
}, },
getStatus(order) { getStatus(order) {
const type = Number(order._status._type); const type = parseInt(order._status._type)
let status = ""; let status = "";
switch (type) { switch (type) {
case 0: case 0:
status = "待付款"; status = "待付款"
break; break;
case 1: case 1:
status = "待发货"; status = "待发货"
break; break;
case 2: case 2:
status = "待收货"; status = "待收货"
break; break;
case 3: case 3:
status = "待评价"; status = "待评价"
break; break;
case 4: case 4:
status = "已完成"; status = "已完成"
break; break;
case -1: case -1:
status = "退款中"; status = "退款中"
break; break;
case -2: case -2:
status = "退款成功"; status = "退款成功"
break; break;
case -3: case -3:
status = "退款失败"; status = "退款失败"
break; break;
case 9: case 9:
status = "已取消"; status = "已取消"
break; break;
default: default:
break; break;
} }
return status; return status
}, },
cancelOrder(order) { cancelOrder(order) {
cancelOrderHandle(order.orderId) cancelOrderHandle(order.orderId).then(() => {
.then(() => { this.getOrderData();
this.getOrderData(); this.orderList.splice(this.orderList.indexOf(order), 1)
this.orderList.splice(this.orderList.indexOf(order), 1); }).catch(() => {
}) this.reload()
.catch(() => { })
this.reload();
});
}, },
paymentTap: function (order) { paymentTap(order) {
const that = this; const that = this
if ( if (
!(order.combinationId > 0 || order.bargainId > 0 || order.seckillId > 0) !(order.combinationId > 0 || order.bargainId > 0 || order.seckillId > 0)
) { ) {
that.setOfflinePayStatus(order.offlinePayStatus); that.setOfflinePayStatus(order.offlinePayStatus)
} }
this.pay = true; this.pay = true;
this.toPay = type => { this.toPay = type => {
payOrderHandle(order.orderId, type, that.from) payOrderHandle(order.orderId, type, that.from).then(() => {
.then(() => { const type = parseInt(this.$yroute.query.type) || 0
const type = parseInt(this.$yroute.query.type) || 0; that.changeType(type);
that.changeType(type); that.getOrderData();
that.getOrderData(); }).catch(() => {
}) const type = parseInt(that.$yroute.query.type) || 0
.catch(() => { that.changeType(type);
const type = parseInt(that.$yroute.query.type) || 0; that.getOrderData();
that.changeType(type); })
that.getOrderData(); }
});
};
}, },
toPay(type) { toPay(type) {
const that = this; const that = this
console.log(type, "支付方式"); // 余额支付需要输入支付密码
//余额支付需要输入支付密码
if (type == "yue") { if (type == "yue") {
this.isShowPayPwdPop = true; this.isShowPayPwdPop = true
return; return
} else { } else {
payOrderHandle(this.orderInfo.orderId, type, that.from); payOrderHandle(this.orderInfo.orderId, type, that.from)
} }
}, },
toDelay(id) { toDelay(id) {
this.delayId = id; this.delayId = id
this.showExtend = true; this.showExtend = true
},
toDelayCancel() {
this.showExtend = false
}, },
doneDelay() { doneDelay() {
orderDelay(this.delayId).then(() => { orderDelay(this.delayId).then(() => {
this.showExtend = false; this.showExtend = false
this.reload() this.reload()
}); })
} }
}, },
onReachBottom() { onReachBottom() {
!this.loading && this.getOrderListReq(); !this.loading && this.getOrderListReq()
} }
}; };
</script> </script>
@@ -800,7 +914,7 @@ page {
.bottom { .bottom {
border-top: 0rpx solid #eee; border-top: 0rpx solid #eee;
height: auto !important; height: auto !important;
padding: 30rpx !important; padding: 0 30rpx 30rpx 30rpx !important;
.bnt { .bnt {
display: flex; display: flex;
justify-content: center; justify-content: center;
+78 -64
View File
@@ -6,11 +6,21 @@
<image class="status-img" :src="getStatusImg(orderInfo)" mode=""></image> <image class="status-img" :src="getStatusImg(orderInfo)" mode=""></image>
</view> --> </view> -->
<view :class="refundOrder ? 'on' : ''"> <view :class="refundOrder ? 'on' : ''">
<view class="state v12-primary-text v12-font-32 v12-font-bold" v-if="orderInfo.isTickets===1 && orderInfo._status._type == 2">待核销</view> <view
<view class="state v12-primary-text v12-font-32 v12-font-bold" v-else>{{ getStatus(orderInfo) }}</view> v-if="orderInfo.isTickets === 1 && orderInfo._status._type === 2"
<view v-if="getStatus(orderInfo)!=='待付款'" class="v12-mt-2 v12-font-24 v12-secondary-dark-text" :class="{'fails-bg': orderInfo._status._type == -3}"> class="state v12-primary-text v12-font-32 v12-font-bold"
>待核销</view>
<view
v-else
class="state v12-primary-text v12-font-32 v12-font-bold"
>{{ getStatus(orderInfo) }}</view>
<view
v-if="getStatus(orderInfo)!=='待付款'"
:class="{'fails-bg': orderInfo._status._type === -3}"
class="v12-mt-2 v12-font-24 v12-secondary-dark-text"
>
<view>{{ orderInfo._status._msg }}</view> <view>{{ orderInfo._status._msg }}</view>
<view v-if="orderInfo._status._type == -3">驳回原因: {{ orderInfo.refundRejectReason }}</view> <view v-if="orderInfo._status._type === -3">驳回原因: {{ orderInfo.refundRejectReason }}</view>
</view> </view>
<view class="pending-payments flex ai-center v12-mt-2 v12-font-24 v12-secondary-dark-text" v-else> <view class="pending-payments flex ai-center v12-mt-2 v12-font-24 v12-secondary-dark-text" v-else>
<text>需支付{{ orderInfo.payPrice }}</text> <text>需支付{{ orderInfo.payPrice }}</text>
@@ -28,8 +38,7 @@
</div> </div>
</view> </view>
</view> </view>
<!-- <view class="reject-reason" v-if="orderInfo._status._type==-3 && orderInfo.refundRejectReason">驳回原因{{ orderInfo.refundRejectReason }}</view> --> <view v-if="orderInfo.deliveryId !== null && ([-1, -2, 3, 4].includes(orderInfo._status._type) || (orderInfo._status._type == 2 && orderInfo.isTickets !== 1))">
<view v-if="orderInfo.deliveryId !== null && (orderInfo._status._type == -1 || orderInfo._status._type == -2 || orderInfo._status._type == 4 || orderInfo._status._type == 3 || (orderInfo._status._type == 2 && orderInfo.isTickets!==1))">
<view <view
v-for="(delivery, index) in orderInfo.deliveryInfo" v-for="(delivery, index) in orderInfo.deliveryInfo"
:key="index" :key="index"
@@ -74,12 +83,18 @@
</view> </view>
</view> </view>
<template v-if="!refundOrder"> <template v-if="!refundOrder">
<view class="code-box flex jc-center ai-center" v-if="orderInfo.isTickets===1 && orderInfo._status._type==2"> <view
v-if="orderInfo.isTickets === 1 && orderInfo._status._type === 2"
class="code-box flex jc-center ai-center"
>
<image class="code-img" :src="orderInfo.code"/> <image class="code-img" :src="orderInfo.code"/>
</view> </view>
<template v-else> <template v-else>
<div class="writeOff" v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1" <div
style="margin-top: 30rpx;border-radius: 24rpx;"> v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1"
class="writeOff"
style="margin-top: 30rpx;border-radius: 24rpx;"
>
<div class="title">核销信息</div> <div class="title">核销信息</div>
<div class="grayBg"> <div class="grayBg">
<div class="pictrue"> <div class="pictrue">
@@ -968,79 +983,78 @@ export default {
if (type == 1 && combination_id > 0) { if (type == 1 && combination_id > 0) {
status.type = 6; status.type = 6;
status.class_status = 1; status.class_status = 1;
} //查看拼团 } // 查看拼团
if (type == 2 && delivery_type == "express") status.class_status = 2; //查看物流 if (type == 2 && delivery_type == "express") status.class_status = 2; // 查看物流
if (type == 2) status.class_status = 3; //确认收货 if (type == 2) status.class_status = 3; // 确认收货
if (type == 4 || type === 0) status.class_status = 4; //删除订单 if (type == 4 || type === 0) status.class_status = 4; // 删除订单
if ( if (
!seckill_id && !seckill_id &&
!bargain_id && !bargain_id &&
!combination_id && !combination_id &&
(type == 3 || type == 4) (type == 3 || type == 4)
) )
status.class_status = 5; //再次购买 status.class_status = 5; // 再次购买
if (type == 9) { if (type == 9) {
//线下付款 // 线下付款
status.class_status = 0; status.class_status = 0;
this.offlineStatus = false; this.offlineStatus = false
} }
this.status = status; this.status = status
}, },
getDetail() { getDetail() {
const id = this.id; const id = this.id
if (!id) { if (!id) {
uni.showToast({ uni.showToast({
title: "订单不存在", title: "订单不存在",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
return; return
} }
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}) })
this.loading = true this.loading = true
orderDetail(id) orderDetail(id).then(res => {
.then(res => { this.orderInfo = res.data
this.orderInfo = res.data; this.orderInfo._status._type = parseInt(this.orderInfo._status._type)
this.getOrderStatus(); this.getOrderStatus()
if (this.orderInfo.combinationId > 0) { if (this.orderInfo.combinationId > 0) {
this.orderTypeName = "拼团订单"; this.orderTypeName = "拼团订单"
this.orderTypeNameStatus = false; this.orderTypeNameStatus = false
} else if (this.orderInfo.bargainId > 0) { } else if (this.orderInfo.bargainId > 0) {
this.orderTypeName = "砍价订单"; this.orderTypeName = "砍价订单"
this.orderTypeNameStatus = false; this.orderTypeNameStatus = false
} else if (this.orderInfo.seckillId > 0) { } else if (this.orderInfo.seckillId > 0) {
this.orderTypeName = "秒杀订单"; this.orderTypeName = "秒杀订单"
this.orderTypeNameStatus = false; this.orderTypeNameStatus = false
} else if (this.orderInfo.isGiftCardReceive === 1 || this.orderInfo.isGiftCardSend === 1) { } else if (this.orderInfo.isGiftCardReceive === 1 || this.orderInfo.isGiftCardSend === 1) {
this.orderTypeName = "礼包订单"; this.orderTypeName = "礼包订单"
this.orderTypeNameStatus = false; this.orderTypeNameStatus = false
}
this.system_store = res.data.systemStore || {}
this.mapKey = res.data.mapKay
this.setOfflinePayStatus(this.orderInfo.offlinePayStatus)
const statusType = this.orderInfo._status._type
if([-1, -2, 4, 3].includes(statusType) || (statusType === 2 && this.orderInfo.isTickets !== 1)) {
for(let i = 0; i < this.orderInfo.deliveryInfo.length; i++) {
this.orderInfo.deliveryInfo[i].estimatedTime = ''
this.getExpressInfo(this.orderInfo.deliveryInfo[i], i)
if (statusType === 2) {
this.getDay(this.orderInfo.deliveryInfo[i], i)
} }
this.system_store = res.data.systemStore || {}; }
this.mapKey = res.data.mapKay; }
this.setOfflinePayStatus(this.orderInfo.offlinePayStatus); }).catch(err => {
const orderInfo = this.orderInfo uni.showToast({
if(orderInfo._status._type == -1 || orderInfo._status._type == -2 || orderInfo._status._type == 4 || orderInfo._status._type == 3 || (orderInfo._status._type == 2 && orderInfo.isTickets!==1)) { title: err.response.data.msg,
for(let i = 0; i < orderInfo.deliveryInfo.length; i++) { icon: "none",
orderInfo.deliveryInfo[i].estimatedTime = '' duration: 2000
this.getExpressInfo(orderInfo.deliveryInfo[i], i) })
if (orderInfo._status._type === 2) { }).finally(() => {
this.getDay(orderInfo.deliveryInfo[i], i) this.loading = false
} uni.hideLoading()
} })
}
})
.catch(err => {
uni.showToast({
title: err.response.data.msg,
icon: "none",
duration: 2000
});
}).finally(() => {
this.loading = false
uni.hideLoading()
});
}, },
async toPay(type) { async toPay(type) {
var that = this; var that = this;
+3 -3
View File
@@ -1,9 +1,9 @@
<template> <template>
<view class="return-list" ref="container"> <view class="return-list" ref="container">
<view class="goodWrapper" v-for="(order,orderListIndex) in orderList" :key="orderListIndex"> <view class="goodWrapper" v-for="(order,orderListIndex) in orderList" :key="orderListIndex">
<view class="iconfont icon-tuikuanzhong powder" v-if="order._status._type === '-1'"></view> <view class="iconfont icon-tuikuanzhong powder" v-if="parseInt(order._status._type) === -1"></view>
<view class="iconfont icon-yituikuan" v-if="order._status._type === '-2'"></view> <view class="iconfont icon-yituikuan" v-if="parseInt(order._status._type) === -2"></view>
<image class="iconfont" :src="webUrl+'/20230713110051999762.png'" v-if="order._status._type === '-3'"/> <image class="iconfont" :src="webUrl+'/20230713110051999762.png'" v-if="parseInt(order._status._type) === -3"/>
<view class="orderNum">订单号{{ order.orderId }}</view> <view class="orderNum">订单号{{ order.orderId }}</view>
<view <view
class="item acea-row row-between-wrapper" class="item acea-row row-between-wrapper"