Files
Smart-Farm/uniapp/uni-app/business/pages/order/list.vue
2025-12-22 17:13:05 +08:00

212 lines
5.3 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="business-order-list" v-if="isLoad">
<fixed>
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex"
:activeColor="primaryColor" :width="100/tabList.length + '%'" height="100rpx"></tab>
<view class="b-1px-b"></view>
</fixed>
<view @tap.stop="goDetail(index)" class="fill-base mt-md ml-md mr-md pd-lg box-shadow-mini radius-16"
v-for="(item,index) in list.data" :key="index">
<view class="flex-between pb-lg">
<view class="f-paragraph c-title"
:class="[{'c-warning': item.pay_type < 3 && item.pay_type != -1},{'c-success': item.pay_type == 3}]">
{{statusType[item.pay_type]}}
</view>
<i class="iconfont icon-right"></i>
</view>
<view class="order-item flex-center" :class="[{'mt-md':aindex!=0}]"
v-for="(aitem,aindex) in item.order_goods" :key="aindex">
<image mode="aspectFill" lazy-load class="avatar box-shadow-mini radius-24" :src="aitem.goods_cover">
</image>
<view class="flex-1 ml-lg">
<view class="f-paragraph c-title text-bold max-490 ellipsis"> {{aitem.goods_name}}
</view>
<view class="f-caption c-title" :class="[{'flex-center':aitem.refund_num*1>0}]">
<view class="ellipsis" :style="{maxWidth:aitem.refund_num*1>0?'300rpx':'490rpx'}">
{{aitem.spe_name}}
</view>
<view class="flex-1 c-warning text-right" v-if="aitem.refund_num*1>0">已退x{{aitem.refund_num}}
</view>
</view>
<view class="flex-y-baseline mt-sm">
<view class="flex-1 f-paragraph c-warning">¥{{aitem.goods_price}} </view>
<view class="f-caption c-caption">x {{aitem.goods_num}} </view>
</view>
</view>
</view>
<view class="flex-between mt-lg pt-md b-1px-t">
<view class="c-title ml-sm mr-sm"> {{`${item.all_goods_num}`}}</view>
<view class="flex-y-baseline f-desc c-title"> 实付
<view class="f-title c-warning">¥{{item.true_price}}</view>
</view>
</view>
<view class="flex-between mt-md" v-if="item.pay_type!=7">
<view></view>
<view @tap.stop="toTel(index)" class="common-btn flex-center f-caption c-base radius-4 ml-lg"
:style="{background:primaryColor}">联系买家
</view>
</view>
</view>
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
</load-more>
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
<view class="space-footer"></view>
</view>
</template>
<script>
import {
mapState,
} from "vuex"
export default {
components: {},
data() {
return {
isLoad: false,
options: {},
activeIndex: 0,
tabList: [{
id: 0,
title: '全部'
}, {
id: 1,
title: '待支付',
number: 0,
key: 'no_pay_count'
}, {
id: 2,
title: '待发货',
number: 0,
key: 'no_send_count'
}, {
id: 3,
title: '已发货',
number: 0,
key: 'have_send_count'
}, {
id: 7,
title: '已完成'
}],
statusType: {
'-1': '已取消',
1: '待支付',
2: '待发货',
3: '已发货',
7: '已完成',
},
param: {
page: 1,
},
list: {
data: []
},
loading: true,
popupInfo: {},
lockTap: false,
}
},
computed: mapState({
primaryColor: state => state.config.configInfo.primaryColor,
subColor: state => state.config.configInfo.subColor,
configInfo: state => state.config.configInfo,
userInfo: state => state.user.userInfo,
}),
onLoad(options) {
this.$util.showLoading()
let {
tab = 0,
} = options
this.options = options
this.activeIndex = tab
this.isLoad = true
this.initIndex()
},
onPullDownRefresh() {
// #ifndef APP-PLUS
uni.showNavigationBarLoading()
// #endif
this.initRefresh()
uni.stopPullDownRefresh()
},
onReachBottom() {
if (this.list.current_page >= this.list.last_page || this.loading) return
this.param.page = this.param.page + 1
this.loading = true
this.getList()
},
methods: {
initIndex() {
let {
expressList
} = this.configInfo
expressList.map(item => {
item.currentCheck = false
item.preCheck = false
})
this.expressList = expressList
this.getList()
},
initRefresh() {
this.param.page = 1
this.initIndex()
},
async getList() {
let {
list: oldList,
param,
tabList,
activeIndex
} = this
param.pay_type = tabList[activeIndex].id
let newList = await this.$api.business
.orderList(param)
if (this.param.page == 1) {
this.list = newList
} else {
newList.data = oldList.data.concat(newList.data)
this.list = newList
}
this.loading = false
this.tabList.map((item, index) => {
if (!item.key) return
this.tabList[index].number = newList[item.key]
})
this.$util.hideAll()
},
handerTabChange(index) {
this.activeIndex = index
this.$util.showLoading()
this.param.page = 1
this.list.data = []
this.getList()
},
toTel(index) {
let {
mobile: url
} = this.list.data[index].address_info
this.$util.goUrl({
url,
openType: 'call'
})
},
// 订单详情
goDetail(index) {
let {
id
} = this.list.data[index]
let url = `/business/pages/order/detail?id=${id}`
this.$util.goUrl({
url
})
}
}
}
</script>
<style lang="scss">
</style>