Files
xdd-uniapp-new/pages/order/MyOrder/index.vue
T
2026-01-10 23:56:33 +08:00

1216 lines
36 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="my-order v12-mx-2" ref="container" @click="handleBody">
<view class="m-search-wrap v12-mb-2 v12-mt-3">
<u-search
v-model="keyword"
:inputStyle="inputStyle"
:showAction="false"
placeholder="请输入商品名/订单号/团购名称"
shape="round"
bgColor="#FFF"
@search="changeType"
/>
</view>
<view class="order-type-tabs v12-mb-2">
<u-tabs
lineHeight="2"
lineColor="#C52733"
:activeStyle="{
color: '#C52733',
fontWeight: 'bold'
}"
:inactiveStyle="{
color: '#333',
fontSize: '28rpx',
fontWeight: 'bold'
}"
:itemStyle="{
height: '30px',
padding: '0 15px !important'
}"
:current="orderTypeTabIndex"
:list="orderTypeTabList"
@click="orderTypeTabChange"
/>
</view>
<view class="m-tab-warp">
<u-tabs
lineHeight="0"
lineColor="#FF564A"
:activeStyle="activeStyle"
:inactiveStyle="inactiveStyle"
:current="type"
:list="tabList"
@click="tabChange"
/>
</view>
<view class="list v12-ma-0" style="padding: 0rpx 0 30rpx;">
<view
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">
<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>
<image
:src="webUrl+'/orderIcon/arrow.png'"
style="width: 24rpx;height: 24rpx; margin-top: 5rpx"
/>
</view>
<view class="flex ai-center">
<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>
</view>
</view>
<view class="title acea-row row-between-wrapper" style="padding: 0 0 0 30rpx !important;">
<view class="acea-row row-middle">
<text
v-if="order.combinationId || order.seckillId || order.bargainId || order.storeId"
class="sign cart-color acea-row row-center-wrapper v12-priamry-text v12-priamry-border v12-radius-40"
>
<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 }}
</view>
<view
v-if="order.isTickets === 1 && parseInt(order._status._type) === 1"
class="font-color-white statusTag v12-primary"
>
待核销
</view>
<view
v-else
class="font-color-white statusTag v12-primary"
>{{ (order.isGiftCardSend || order.isGiftCardReceive) ? '礼包' : getStatus(order) }}</view>
</view>
<view @click="goOrderDetails(order)">
<view
v-if="order.isGiftCardReceiveBlind === 1"
class="item-info acea-row row-between row-top"
>
<view class="pictrue">
<image
:src="webUrl+'/orderIcon/盲盒礼包.png'"
/>
</view>
</view>
<view v-if="order.isTravelGroup === 1">
<view
class="item-info acea-row row-between row-top"
>
<view class="pictrue">
<image
:src="order.travelGroupOrderInfo.travelGroupProduct.mainImage"
/>
</view>
<view class="text">
<view class="acea-row name-wrap">
<view class="name more-t v12-font-bold">{{ order.travelGroupOrderInfo.travelGroupProduct.name }}</view>
<view class="money">
<view>
<text class="v12-font-22"></text>
<text class="v12-font-28">{{ force2Decimal(order.travelGroupOrderInfo.travelGroupProduct.price) }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-else>
<view
v-for="(cart,cartInfoIndex) in order.cartInfo"
:key="cartInfoIndex"
class="item-info acea-row row-between row-top"
>
<view class="pictrue">
<image
v-if="cart.combinationId === 0 && cart.bargainId === 0 &&cart.seckillId === 0"
:src="cart.productInfo.image"
@click.stop="gotoGoodDetail(cart, 1, { id: cart.productInfo.id })"
/>
<image
v-else-if="cart.combinationId > 0"
:src="cart.productInfo.image"
@click.stop="gotoGoodDetail(cart, 2, { id: cart.combinationId })"
/>
<image
v-else-if="cart.bargainId > 0"
:src="cart.productInfo.image"
@click.stop="gotoGoodDetail(cart, 3, { id: cart.bargainId })"
/>
<image
v-else-if="cart.seckillId > 0"
:src="cart.productInfo.image"
@click.stop="gotoGoodDetail(cart, 4, { id: cart.seckillId })"
/>
</view>
<view class="text">
<view class="acea-row name-wrap">
<view class="name more-t v12-font-bold">{{ cart.productInfo.storeName }}</view>
<view class="money">
<view>
<text class="v12-font-22"></text>
<text class="v12-font-28">{{ force2Decimal(cart.truePrice) }}</text>
</view>
</view>
</view>
<view class="acea-row attr-wrap ">
<view
v-if="cart.productInfo.attrInfo"
class="attr v12-secondary-dark-text v12-font-24 "
>
{{ cart.productInfo.attrInfo.sku }}
</view>
<view class="v12-dark-text v12-font-22">x{{ cart.cartNum }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="totalPrice acea-row row-between row-middle" :style="{'padding-bottom': order.isTravelGroup === 1 ? '0rpx !important' : '30rpx'}">
<view v-if="order.createTime">
<span class="orderTime v12-font-24 v12-dark1-text">{{ order.createTime }}</span>
</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>
</view>
</view>
<view class="v12-ml-4 v12-mt-2 v12-mb-2 v12-align-center" v-if="order.isTravelGroup === 1 && order.travelGroupOrderInfo && order.travelGroupOrderInfo.orderStartDate">
<u-icon name="clock" color="#333" size="28rpx" bold></u-icon>
<text class="v12-font-bold v12-font-24">
入住时间: {{ order.travelGroupOrderInfo.orderStartDate }}
</text>
</view>
<view v-if="order._status && ['1'].includes(order._status._type) && order.confirmTimeout" class="v12-ml-4 v12-mb-2" >
<view class="v12-primary-text v12-font-24 v12-align-center">
等待商家确认时间剩余
<u-count-down format="HH:mm:ss" autoStart :time="$global.diffSSS(order.confirmTimeout)" />
订单将自动取消
</view>
</view>
<view
v-if="!order.isGiftCardSend"
class="bottom flex jc-between ai-center"
>
<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
v-if="order.merName && order.isGiftCardReceiveBlind === 0"
class="btn btn-service flex jc-center ai-center v12-font-24"
@click="goRoom(order)"
>联系商家</view>
<view
v-if="order.isTravelGroup === 0"
class="btn flex jc-center ai-center v12-font-24"
@click="goRefund(order)"
>申请退款</view>
</view>
</view>
<template v-else>
<view class="v12-justify-between" style="width: 100%">
<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 class="v12-justify-between">
<view
class="bnt service"
@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>
</template>
<view class="flex">
<template v-if="parseInt(order._status._type) === 0">
<view
class="bnt cancelBnt v12-dark-text v12-dark-border"
@click="cancelOrder(order)"
>取消订单</view>
<view
v-if="order.isTravelGroup === 0"
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 v-if="parseInt(order._status._type) === 1 && order.isTickets === 0">
<view
v-if="order.isTravelGroup === 1"
class="bnt service"
@click="editTime(order)"
>{{ '修改时间' }}</view>
<view
v-if="order.isTravelGroup === 1"
class="bnt service"
@click="applyRefund(order)"
>{{ '申请退款' }}</view>
<view
class="bnt service"
:class="{'v12-primary-text v12-primary-border': order.isTravelGroup === 1}"
@click="goOrderDetails(order)"
>{{ order.isTravelGroup === 0 ? '查看详情' : '查看券码' }}</view>
</template>
<template v-if="parseInt(order._status._type) === 1 && order.isTickets === 1">
<view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="goOrderDetails(order)"
>立即核销</view>
</template>
<template v-if="parseInt(order._status._type) === 2 && order.isTickets === 0 && order.isTravelGroup === 1">
<view
v-if="order.isTravelGroup === 1"
class="bnt service"
@click="editTime(order)"
>{{ '修改时间' }}</view>
<view
v-if="order.isTravelGroup === 1"
class="bnt service"
@click="applyRefund(order)"
>{{ '申请退款' }}</view>
<view
class="bnt service"
:class="{'v12-primary-text v12-primary-border': order.isTravelGroup === 1}"
@click="goOrderDetails(order)"
>{{ order.isTravelGroup === 0 ? '查看详情' : '查看券码' }}</view>
</template>
<template v-if="parseInt(order._status._type) === 2 && order.isTickets === 0 && order.isTravelGroup === 0">
<view
v-if="order.isExtendedDelivery === 0"
class="bnt default"
@click="toDelay(order.orderId)"
>延长收货
</view>
<view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="takeOrder(order)"
>确认收货</view>
</template>
<template v-if="parseInt(order._status._type) === 3 && order.isTravelGroup === 0">
<view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="goOrderDetails(order)"
>去评价</view>
</template>
<template v-if="parseInt(order._status._type) === 3 && order.isTravelGroup === 1">
<view
class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40"
@click="goOrderDetails(order)"
>去评价</view>
</template>
<template v-if="parseInt(order._status._type) === 4">
<view class="bnt service" @click="goOrderDetails(order)">查看订单</view>
</template>
</view>
</view>
<view class="bottom" v-else>
<view class="v12-font-24 v12-grey tips-text" >
{{ Number(order.status) === 0 ? '待支付' : getGiftTips(order.giftCardInfo) }}
</view>
<view class="flex jc-between ai-center">
<view
v-if="order.merName && order.isGiftCardReceiveBlind === 0"
class="bnt btn-service flex jc-center ai-center v12-font-24"
@click="goRoom(order)"
>联系商家
</view>
<view class="v12-align-center">
<button
v-if="Number(order.status) !== 0 &&
order.giftCardInfo.giftCardStatus !== 9 &&
getGiftTips(order.giftCardInfo) &&
order.giftCardInfo.giftCardStatus !== 2 &&
order.giftCardInfo.giftNum !== order.giftCardInfo.receiveNum
"
open-type="share"
class="gift-btn service v12-primary-text v12-primary-border"
@click="shareGift(order)"
>送给朋友</button>
<button
v-if="Number(order.status) === 0"
class="gift-btn service v12-primary-text v12-primary-border"
@click="subscribePay(order)"
>立即支付</button>
<view class="bnt service" @click="goOrderDetails(order)">查看详情</view>
</view>
</view>
</view>
<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>
<u-modal
:show="showExtend"
title="确认延长收货时间?"
content='每笔订单只能延长一次哦'
showCancelButton
@cancel="toDelayCancel"
@confirm="doneDelay"
/>
<view
v-if="orderList.length === 0 && page > 1"
class="noCart"
>
<view class="pictrue">
<image :src="webUrl+'/20240102232734472795.png'"/>
</view>
</view>
<Loading
:loaded="loaded"
:loading="loading"
/>
<Payment
v-model="pay"
:types="payType"
:balance="userInfo.nowMoney"
@checked="toPay"
/>
<passkeyborad
v-if="isShowPayPwdPop"
ref='payPwdPop'
:money="orderInfo.payPrice"
showMoney
:show="isShowPayPwdPop"
@close="pwdPopClose"
@finish="pwdPopFinish"
/>
<DateRangePicker
ref="DateRangePicker"
:originDate="travelGroupOrderInfo.orderStartDate"
v-model="dateRange"
:show="showDatePicker"
:minBookingDays="travelGroupOrderInfo.minBookingDays"
:travelGroupProductId="travelGroupOrderInfo.travelGroupProduct.id"
@update:show="showDatePicker = false"
@input="handleDateSelected"
></DateRangePicker>
</view>
</template>
<script>
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
import DateRangePicker from '@/components/DateRangePicker/DateRangePicker.vue'
import { sojoumOrderCheckInTime } from "@/api/sojoumOrder";
import {
getOrderData,
getOrderList,
orderDelay,
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'
export default {
name: "MyOrder",
mixins: [pageListenMixins],
data() {
return {
giftItem: {},
isShowPayPwdPop: false,
inputStyle: {
height: '64rpx',
},
activeStyle: {
color: '#C52733',
background: 'rgba(197,39,51,0.1)',
borderRadius: '30rpx',
padding: '5rpx 20rpx',
fontWeight: '600'
},
inactiveStyle: {
height: '48rpx !important',
background: '#fff !important',
borderRadius: '30rpx !important',
color: '#333333 !important',
padding: '5rpx 15rpx',
fontSize: '28rpx !important',
lineHeight: '48rpx !important'
},
webUrl: this.$VUE_APP_RESOURCES_URL,
tabList: [
{ name: '全部' },
{ name: '待付款' },
{ name: '待发货' },
{ name: '待收货/待核销' },
{ name: '退款/售后' },
{ name: '待评价' },
{ name: '已完成' }
],
orderTypeTabList: [
{ name: '购物', orderType: 'shop' },
{ name: '旅居', orderType: 'travel' }
],
orderTypeTabIndex: 0,
orderType: 'shop',
offlinePayStatus: 2,
orderData: {},
type: 0,
page: 1,
limit: 20,
loaded: false,
loading: false,
orderList: [],
pay: false,
payType: ["yue", "weixin"],
from: this.$deviceType,
orderInfo: {},
travelGroupOrderInfo: {},
showExtend: false,
delayId: null,
pageKeyId: Object.freeze('userOrderIndex'),
keyword: '',
_orderId: '',
showDatePicker: false,
dateRange: []
}
},
components: {
Loading,
Payment,
passkeyborad,
DateRangePicker
},
computed: mapGetters(["userInfo"]),
onShow() {
const _this = this
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
const addressId = chooseAddress.id || ''
// 监听到选择收货地址
if (addressId) {
uni.setStorageSync('chooseAddress', {})
uni.showModal({
title:'确定修改地址吗?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success:(success)=>{
if(success.confirm) {
uni.showLoading()
editAddress({
addressId,
orderId: _this._orderId
}).then(res => {
uni.showToast({
icon: 'success',
title: '修改成功!'
})
uni.setStorageSync('sourceAddress', chooseAddress)
_this.changeType()
}).finally(() => {
uni.hideLoading()
})
}
},
cancel: () => {
_this.changeType()
},
complete:(complete)=>{
_this._orderId = ''
}
})
}
},
onLoad() {
this.type = this.type || parseInt(this.$yroute.query.type) || 0
this.changeType(this.type)
},
onShareAppMessage() {
uni.updateShareMenu({
isPrivateMessage: true,
withShareTicket: true
})
return {
title: '礼笺轻启,礼藏心意',
path: `/pkg_user/views/gift/receive?code=${this.giftItem.giftCardInfo.code}&isTravelGroup=${this.giftItem.isTravelGroup ? 1 : 0}`,
imageUrl: this.giftItem.giftCardInfo.giftCardImage
}
},
methods: {
handleDateSelected(dateRange) {
const params = {
orderId: this.orderInfo.orderId,
orderStartDate: dateRange[0],
orderEndDate: dateRange[1]
}
uni.showLoading({
title: '加载中...',
mask: true,
})
sojoumOrderCheckInTime(params).then(res => {
if (res.status === 200) {
uni.showToast({
title: '入住时间修改成功',
icon: 'success'
})
this.changeType()
}
}).finally(() => {
uni.hideLoading();
})
},
editTime(order) {
this.showDatePicker = true
this.travelGroupOrderInfo = order.travelGroupOrderInfo
this.orderInfo = order
},
applyRefund(order) {
// 这里可以添加申请退款的逻辑,比如跳转到退款页面
uni.navigateTo({
url: '/pkg_product/views/sojoumOrderRefund?id=' + order.orderId
})
},
getTime(type) {
const timeMap = {
1:"48小时内",
2:"72小时内",
3:"24小时内",
4: "7天内",
5: "15天内"
}
return timeMap[type]
},
shareGift(item) {
this.giftItem = item
},
getGiftTips(giftCardInfo) {
// giftCardStatus int 礼品卡状态 0-未领取 1-已领取 2-已失效
// (1)礼品全部领取:礼品已全部被好友领取,不支持取消哦!
// (2)礼品部分领取:礼品已领取X/X份,不支持取消哦!
// (3)礼品还未被领取过:下单成功,记得分享给朋友领取哦
// giftNum int 礼品数量
// receiveNum int 已被领取数量
if (!giftCardInfo) {
return ''
}
if (giftCardInfo.giftCardStatus === 0) {
return giftCardInfo.receiveNum === 0 ? '下单成功,记得分享给朋友领取哦' : '礼品已领取' + giftCardInfo.receiveNum + '/' + giftCardInfo.giftNum + '份,不支持取消哦!'
} else if (giftCardInfo.giftCardStatus === 1) {
return giftCardInfo.giftNum === giftCardInfo.receiveNum ? '礼品已全部被好友领取,不支持取消哦!' : '礼品已领取' + giftCardInfo.receiveNum + '/' + giftCardInfo.giftNum + '份,不支持取消哦!'
} else if (giftCardInfo.giftCardStatus === 2) {
if (giftCardInfo.giftNum > 1) {
return `礼品已领取${giftCardInfo.receiveNum}/${giftCardInfo.giftNum}份${giftCardInfo.refundNum > 0 ? ('' + giftCardInfo.refundNum + '份已退回') : ''}`
}
return '该礼包已退款'
} else {
return '已取消'
}
},
handleBody() {
this.orderList.forEach((e) => {
e.showMore = false
})
this.$forceUpdate()
},
delOrder(order) {
delOrderHandle(order.orderId).then(() => {
this.page = 1
this.orderList = [];
this.getOrderListReq()
})
},
goStore(order) {
if(order.isTravelGroup === 1) {
// uni.showToast({
// title: '该订单为团体订单,无法查看店铺信息!'
// })
return
}
if(!order.hotelId) {
uni.showToast({
title: '未找到相关店铺!'
})
return
}
this.$yrouter.push({
path: "/pagesInn/inn/innHome",
query: {
id: order.hotelId
}
})
},
async toYuePay(payPwd) {
const that = this;
//网络请求
await yuePayOrderHandle(this.orderInfo.orderId, "yue", that.from, payPwd);
that.changeType();
this.payPassword = "";
},
pwdPopClose() {
this.isShowPayPwdPop = false
},
pwdPopFinish(payPwd) {
this.payPassword = payPwd
this.toYuePay(payPwd)
this.isShowPayPwdPop = false
},
subscribePay(order) {
this.orderInfo = order
uni.requestSubscribeMessage({
tmplIds: [
'7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE',
'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU',
'9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'
],
complete: () => this.pay = true
})
},
addressTap(order) {
this._orderId = order.orderId
this.$yrouter.push({
path: "/pages/user/address/AddressManagement/index",
query: {
choosMode: 1
}
})
},
force2Decimal(v) {
return this.$force2Decimal(v)
},
goRoom(order) {
console.log(order);
if(order.isTravelGroup === 1) {
// 拨打商家电话
uni.makePhoneCall({
phoneNumber: order.merPhone,
})
return
}
const params = {
goodsId: order.cartInfo[0].productId,
goodsName: order.cartInfo[0].productInfo.storeName,
skuStr: order.cartInfo[0].productInfo.attrInfo.sku,
price: order.cartInfo[0].productInfo.attrInfo.price,
seckillId: order.cartInfo[0].seckillId,
cover: order.cartInfo[0].productInfo.attrInfo.image,
goodsData: '',
seckillData: ''
}
uni.navigateTo({
url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}&params=${JSON.stringify(params)}`
})
},
goRefund(order) {
// fix bug#1631
if (this.type === 4 || parseInt(order._status._type) === 3) {
// 打开售后的目的就是开启已完成/待评价订单的退款功能,确认打开售后之后,小程序用户再点击申请退款,就可以进入退款申请填写页面,正常走退款流程,提交退款申请以后,订单状态变为退款中
if (order.refundSystemStatus === 0) {
uni.showToast({
title: '订单已收货,如需退款请联系商家',
mask: false,
icon: 'none',
duration: 3000
})
} else {
uni.navigateTo({
url: `/pkg_orders/views/refund?id=${order.orderId}`
})
}
} else {
uni.navigateTo({
url: `/pkg_orders/views/refund?id=${order.orderId}`
})
}
},
goLogistics(order) {
this.$yrouter.push({
path: "/pages/order/Logistics/index",
query: {
id: order.orderId
}
});
},
goOrderDetails(order) {
if(order.isTravelGroup === 1) {
this.$yrouter.push({
path: "/pkg_product/views/sojoumOrderDetails",
query: {
id: order.orderId,
isView: 1
}
});
return
}
this.$yrouter.push({
path: "/pages/order/OrderDetails/index",
query: {
id: order.orderId,
isGift: order.isGiftCardSend ? 1 : ''
}
})
},
setOfflinePayStatus: function (status) {
const that = this
that.offlinePayStatus = status
if (status === 1) {
if (that.payType.indexOf("offline") < 0) {
that.payType.push("offline")
}
}
},
gotoGoodDetail(cart, type, query){
// isProductStillExist:0-不存在,1-存在
const isProductStillExist = cart.isProductStillExist || 0
if (isProductStillExist === 0) {
this.$dialog.toast({ mes: '商品已下架' })
return
}
let path = ''
switch(type) {
case 1:
path = '/pages/shop/GoodsCon/index'
break
case 2:
path = '/pages/activity/GroupDetails/index'
break
case 3:
path = '/pages/activity/DargainDetails/index'
break
case 4:
path = '/pages/activity/SeckillDetails/index'
break
}
this.$yrouter.push({ path, query })
},
getOrderData() {
getOrderData().then(res => {
this.orderData = res.data
})
},
takeOrder(order) {
const that = this
uni.showModal({
title: '是否确认收货?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: res => {
if (res.confirm) {
takeOrderHandle(order.orderId).finally(() => {
that.reload()
that.getOrderData()
})
}
}
})
},
reload() {
this.changeType(this.type)
},
tabChange(item) {
this.type = item.index
this.$yroute.query.type = this.type
this.changeType()
},
orderTypeTabChange(item) {
this.orderTypeTabIndex = item.index
this.orderType = item.orderType
this.changeType()
},
changeType() {
this.orderList = []
this.page = 1
this.loaded = false
this.loading = false
this.getOrderListReq()
},
getOrderListReq() {
if (this.loading || this.loaded) return
this.loading = true
const types = {
0: 0,
1: 1,
2: 2,
3: 3,
4: -3,
5: 4,
6: 5,
}
const type = types[this.type]
const {
page,
limit,
keyword,
orderType
} = this
getOrderList({
page,
limit,
type,
keyword,
orderType
}).then(res => {
this.orderList = this.orderList.concat(res.data)
if (this.orderList.length > 0) {
this.orderList.forEach(item => {
item.showMore = false;
})
}
this.page++;
this.loaded = res.data.length < this.limit
this.loading = false
}).finally(() => {
this.loading = false
});
},
tapShowMore(order, index) {
order.showMore = !order.showMore;
this.$set(this.orderList, index, order);
},
getStatus(order) {
const type = parseInt(order._status._type)
let status = "";
switch (type) {
case 0:
status = "待付款"
break;
case 1:
status = order.isTravelGroup === 1 ? "待使用" : "待发货"
break;
case 2:
status = order.isTravelGroup === 1 ? "待使用" : "待收货"
break;
case 3:
status = order.isTravelGroup === 1 ? "已完成" : "待评价"
break;
case 4:
status = "已完成"
break;
case -1:
status = "退款中"
break;
case -2:
status = "退款成功"
break;
case -3:
status = "退款失败"
break;
case 9:
status = "已取消"
break;
default:
break;
}
return status
},
cancelOrder(order) {
cancelOrderHandle(order.orderId).then(() => {
this.getOrderData();
this.orderList.splice(this.orderList.indexOf(order), 1)
}).catch(() => {
this.reload()
})
},
paymentTap(order) {
const that = this
if (
!(order.combinationId > 0 || order.bargainId > 0 || order.seckillId > 0)
) {
that.setOfflinePayStatus(order.offlinePayStatus)
}
this.pay = true;
this.toPay = type => {
payOrderHandle(order.orderId, type, that.from).then(() => {
const type = parseInt(this.$yroute.query.type) || 0
that.changeType(type);
that.getOrderData();
}).catch(() => {
const type = parseInt(that.$yroute.query.type) || 0
that.changeType(type);
that.getOrderData();
})
}
},
toPay(type) {
const that = this
// 余额支付需要输入支付密码
if (type == "yue") {
this.isShowPayPwdPop = true
return
} else {
payOrderHandle(this.orderInfo.orderId, type, that.from)
}
},
toDelay(id) {
this.delayId = id
this.showExtend = true
},
toDelayCancel() {
this.showExtend = false
},
doneDelay() {
orderDelay(this.delayId).then(() => {
this.showExtend = false
this.reload()
})
}
},
onReachBottom() {
!this.loading && this.getOrderListReq()
}
};
</script>
<style>
.my-order .u-tabs{
background-color: transparent !important;
position: sticky !important;
}
.my-order .u-tabs__wrapper__nav__item{
padding: 0 8rpx !important;
}
.my-order .u-search__content{
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.1);
}
</style>
<style scoped lang="less">
page {
background-color: #fff;
}
.order-tips{
height: 44rpx;
background: rgba(0,0,0,0.05);
border-radius: 40rpx;
padding: 5rpx 24rpx;
line-height: 44rpx;
}
.m-tab-warp{
position: sticky;
top: 0;
background-color: #f5f5f5;
z-index: 1;
}
/deep/ .u-tabs {
position: fixed;
z-index: 1;
background-color: #fff;
left: 0;
top: 0
}
.list {
.item:first-child{
margin-top: 0;
}
.item {
margin: 30rpx 0;
border-radius: 12rpx;
.shop-info {
padding: 20rpx 16rpx;
// border-bottom: 2rpx solid #eee;
.name {
margin-left: 6rpx;
color: #333;
font-size: 24rpx;
line-height: 36rpx;
font-weight: bold;
}
.address {
margin-left: 4rpx;
color: #C52733;
font-size: 22rpx;
line-height: 36rpx;
}
}
.title {
border-bottom: none;
}
.item-info {
margin: 0 30rpx;
padding: 0 0 0 0;
}
.totalPrice {
border-bottom: none;
}
.bottom {
border-top: 0rpx solid #eee;
height: auto !important;
padding: 0 30rpx 30rpx 30rpx !important;
.bnt {
display: flex;
justify-content: center;
align-items: center;
width: 128rpx;
height: 44rpx;
border-radius: 40rpx;
font-size: 24rpx;
// font-weight: bold;
border: 1px solid #707070;
color: #333;
padding: 1px 3px;
}
.service {
border: 1px solid #707070;
color: #333;
}
}
}
}
.noCart {
margin-top: 0.17 * 100rpx;
padding-top: 0.1 * 100rpx;
}
.noCart .pictrue {
width: 408rpx;
height: 414rpx;
overflow: hidden;
margin: 0.7 * 100rpx auto 0.5 * 100rpx auto;
}
.noCart .pictrue image {
width: 408rpx;
height: 414rpx;
}
.statusTag {
font-size: 24rpx;
color: #fff;
padding: 4rpx 20rpx;
background: #0DC5C5;
height: 38rpx;
line-height: 38rpx;
border-radius: 60rpx 0px 0px 60rpx;
}
.group-btn {
position: relative;
.btn-more {
color: #999;
font-size: 28rpx;
}
.group-float {
position: absolute;
width: 196rpx;
box-sizing: border-box;
box-shadow: 0 2px 16px rgba(0, 0, 0, 0.16);
padding: 0 20rpx;
background: #fff;
.btn {
box-sizing: border-box;
padding: 20rpx 0;
color: #333;
font-size: 32rpx;
line-height: 1;
}
.btn-service {
border-bottom: 1rpx solid #F0F0F0;
}
}
}
.my-order .list .item .item-info .name-wrap,
.my-order .list .item .item-info .attr-wrap {
justify-content: space-between;
}
.my-order .list .item .item-info .attr-wrap {
margin: 10rpx 0 0 0;
}
.my-order .list .item .item-info .text .name {
width: calc(100% - 160rpx);
}
.tips-text{
padding: 0 12rpx;
height: 60rpx;
background: rgba(248,246,246,0.39);
color: #C52733;
line-height: 60rpx;
margin-bottom: 30rpx;
}
.gift-btn{
display: flex;
align-items: center;
text-align: center;
height: 52rpx;
padding: 0 12rpx;
border-radius: 100rpx;
border: 1px solid #C52733 !important;
line-height: 60rpx;
font-size: 26rpx;
color: #C52733;
background: #fff;
padding: 1px 3px;
width: 142rpx;
width: 142rpx;
justify-content: center;
margin-right: 20rpx;
}
</style>