初始化代码
This commit is contained in:
178
uniapp/uni-app/farmer/pages/order/claim/list.vue
Normal file
178
uniapp/uni-app/farmer/pages/order/claim/list.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<view class="farmer-order-claim-list">
|
||||
<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="order-item fill-base mg-big pd-lg radius-16 box-shadow"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pb-lg">
|
||||
<view class="f-paragraph c-title"
|
||||
:style="{color:item.pay_type == 1? subColor: item.pay_type == 2? primaryColor: ''}">
|
||||
{{statusType[item.pay_type]}}
|
||||
</view>
|
||||
<i class="iconfont icon-right"></i>
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<image mode="aspectFill" lazy-load class="avatar radius-24" :src="item.goods_cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title text-bold ellipsis" style="max-width: 498rpx;"> {{item.goods_name}}
|
||||
</view>
|
||||
<view class="f-caption c-caption mt-sm"> 数量:{{`${item.num}/${item.unit}`}} </view>
|
||||
<view class="f-caption c-caption"> 配送周期:{{item.send_cycle}} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph mt-md pt-md b-1px-t">
|
||||
<view class="c-desc max-380 ellipsis">认养编号 {{item.claim_code}}</view>
|
||||
<view class="flex-y-baseline c-title">总计:<view class="f-title c-warning">¥{{item.pay_price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between mt-md">
|
||||
<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 {
|
||||
options: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 0,
|
||||
title: '全部'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '认养中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 3,
|
||||
title: '配送中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 7,
|
||||
title: '已完成'
|
||||
}],
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
1: '待支付',
|
||||
2: '认养中',
|
||||
3: '配送中',
|
||||
7: '已完成',
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
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.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() {
|
||||
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.farmer.claimOrderList(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[1].number = newList.claim_ing
|
||||
this.tabList[2].number = newList.send_ing
|
||||
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 = `/claim/pages/order/detail?id=${id}&farmer=1`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
Reference in New Issue
Block a user