初始化代码

This commit is contained in:
2025-12-22 17:13:05 +08:00
parent ed0de08e3a
commit 1f7e9d401b
2947 changed files with 526137 additions and 0 deletions

View File

@@ -0,0 +1,366 @@
<template>
<view class="farmer-order-distribution-detail" v-if="detail.id">
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="配送订单详情">
</uni-nav-bar>
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png"></image>
<view class="pl-lg pr-lg c-base" style="height: 120rpx;">
<view class="f-sm-title text-bold pt-md">{{statusType[detail.pay_type]}}</view>
<view class="f-caption">
<block v-if="detail.pay_type == -1">已退配送费 ¥{{detail.pay_price}}</block>
<block v-if="detail.pay_type == 2">请尽快为买家配送该商品</block>
</view>
</view>
<view class="order-text-info ml-md mr-md pd-lg fill-base f-paragraph c-title box-shadow radius-24"
v-if="detail.send_type == 2">
<view @tap.stop="toMap" class="flex-warp">
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx;margin-top: 6rpx;"></i>
<view class="flex-1">{{detail.address}}</view>
</view>
<view @tap.stop="$util.goUrl({url:detail.mobile,openType:'call'})" class="flex-y-baseline c-caption"
style="margin:5rpx 0 0 38rpx;">{{detail.user_name}}
<view class="ml-lg">
{{detail.mobile}}
</view>
</view>
</view>
<view class="order-text-info mt-md ml-md mr-md pl-lg pr-lg fill-base f-paragraph c-title box-shadow radius-24">
<view class="flex-between pt-lg pb-lg">
<view class="text c-desc">配送单号</view>
<view class="flex-y-center">
<view class="max-350 ellipsis">{{detail.order_code}}</view>
<view @tap="$util.goUrl( {url:`${detail.order_code}`,openType:'copy'})"
class="copy-btn flex-center fill-body" :style="{color:primaryColor}">复制</view>
</view>
</view>
<view class="flex-between pt-lg pb-lg b-1px-t">
<view class="text c-desc">{{detail.send_type == 1 ? '自提时间':'送货时间'}}</view>
<view>{{detail.time_text}}</view>
</view>
<view class="flex-between pt-lg pb-lg b-1px-t">
<view class="text c-desc">配送方式</view>
<view>{{sendType[detail.send_type]}}</view>
</view>
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.send_type == 1">
<view class="text c-desc">自提人</view>
<view class="flex-y-center">
<view class="max-350">{{`${detail.user_name} ${detail.mobile}`}}</view>
<view @tap="$util.goUrl( {url:`${detail.mobile}`,openType:'call'})"
class="copy-btn flex-center fill-body" :style="{color:primaryColor}">拨打</view>
</view>
</view>
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.pay_type > 2 && detail.send_type == 2">
<view class="text c-desc">发货时间</view>
<view>{{detail.send_time}}</view>
</view>
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.pay_type == 7">
<view class="text c-desc">{{detail.send_type == 1 ? '取货时间':'收货时间'}}</view>
<view>{{detail.receiving_time}}</view>
</view>
<view class="pt-lg pb-lg b-1px-t" v-if="detail.text">
<view class="text c-desc">备注</view>
<view class="mt-sm">
<text decode="emsp" style="word-break:break-all;">{{detail.text}}</text>
</view>
</view>
</view>
<view class="mt-md ml-md mr-md pd-lg fill-base f-paragraph c-title box-shadow radius-24">
<view class="order-item flex-center">
<image mode="aspectFill" lazy-load class="avatar box-shadow-mini radius-24"
:src="detail[orderText[options.type]].goods_cover"></image>
<view class="flex-1 ml-lg">
<view class="f-title c-title text-bold max-490 ellipsis">
{{detail[orderText[options.type]].goods_name}}
</view>
<block v-if="options.type == 1">
<view class="f-caption c-caption mt-sm">
数量{{`${detail[orderText[options.type]].num}/${detail[orderText[options.type]].unit}`}}
</view>
<view class="f-caption c-caption"> 配送周期{{detail[orderText[options.type]].send_cycle}}
</view>
</block>
<block v-if="options.type == 2">
<view class="f-caption c-caption mt-sm">租赁期限{{detail[orderText[options.type]].end_time}} 到期
</view>
<view class="f-caption c-caption"> 租赁面积{{detail[orderText[options.type]].area}} </view>
</block>
</view>
</view>
</view>
<view class="fill-base mt-md ml-md mr-md pl-lg pr-lg f-paragraph c-title box-shadow radius-24"
v-if="options.type == 1">
<view class="pt-lg pb-lg f-title text-bold b-1px-b">认养收获</view>
<view class="pt-lg pb-lg">
<view class="order-seed-item flex-center">
<image mode="aspectFill" lazy-load classload class="seed-img radius-10"
:src="detail.claim_order.harvest_cover"></image>
<view class="flex-1 ml-lg f-paragraph c-title ellipsis">{{detail.claim_order.harvest_text}}</view>
</view>
</view>
</view>
<view class="mt-md ml-md mr-md pl-lg pr-lg fill-base f-paragraph c-title box-shadow radius-24"
v-if="options.type == 2 && detail.land_order.seed.length > 0">
<view class="pt-lg pb-lg f-title text-bold b-1px-b">种子管理</view>
<view class="pt-lg pb-lg">
<view class="order-seed-item flex-center" :class="[{'mt-md':index!=0}]"
v-for="(item,index) in detail.land_order.seed" :key="index">
<image mode="aspectFill" lazy-load classload class="seed-img radius-10" :src="item.imgs"></image>
<view class="flex-1 ml-lg c-title">
<view class="flex-between">
<view class="f-paragraph max-380 ellipsis">{{item.title}}</view>
<view class="f-caption">{{item.area}}</view>
</view>
<view class="flex-between f-caption c-caption">
<view class="c-warning">¥{{item.seed_price}}</view>
<view>x{{item.num}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="order-text-info mt-md ml-md mr-md pl-lg pr-lg fill-base f-paragraph c-title box-shadow radius-24"
v-if="detail.send_type == 2">
<view class="flex-between pt-lg pb-lg">
<view class="text">配送费</view>
<view>¥{{detail.pay_price}}</view>
</view>
<view class="flex-between pt-lg pb-lg b-1px-t">
<view class="text">实付金额</view>
<view class="c-warning text-bold">¥{{detail.pay_price}}</view>
</view>
</view>
<view class="order-text-info mt-md ml-md mr-md pd-lg fill-base f-caption c-title box-shadow radius-24">
<view class="flex-warp pt-sm">
<view class="text c-caption">订单类型</view>
<view class="flex-1">{{orderType[options.type]}}</view>
</view>
<block v-if="detail.send_type == 2">
<view class="flex-warp pt-md">
<view class="text c-caption">付款单号</view>
<view class="flex-1 flex-y-center">{{detail.transaction_id}}
<view @tap="$util.goUrl( {url:`${detail.transaction_id}`,openType:'copy'})"
class="copy-btn sm flex-center fill-body" :style="{color:primaryColor}">复制</view>
</view>
</view>
<view class="flex-warp pt-md" v-if="detail.pay_type == -1">
<view class="text c-caption">退款单号</view>
<view class="flex-1 flex-y-center">{{detail.refund_code}}
<view @tap="$util.goUrl( {url:`${detail.refund_code}`,openType:'copy'})"
class="copy-btn sm flex-center fill-body" :style="{color:primaryColor}">复制</view>
</view>
</view>
</block>
<view class="flex-warp pt-md">
<view class="text c-caption">下单时间</view>
<view class="flex-1">{{detail.create_time}}</view>
</view>
<block v-if="detail.send_type == 2">
<view class="flex-warp pt-md" v-if="detail.pay_time">
<view class="text c-caption">支付时间</view>
<view class="flex-1">{{detail.pay_time}}</view>
</view>
<view class="flex-warp pt-md" v-if="detail.pay_type == -1">
<view class="text c-caption">退款时间</view>
<view class="flex-1">{{detail.refund_time}}</view>
</view>
<view class="flex-warp pt-md">
<view class="text c-caption">支付方式</view>
<view class="flex-1">{{payType[detail.pay_model]}}</view>
</view>
</block>
</view>
<view :class="[{'space-max-footer':detail.pay_type == 2},{'space-footer':detail.pay_type != 2}]"></view>
<block v-if="detail.pay_type == 2">
<fix-bottom-button @confirm="toChangeOrder('confirm_get_item')" :text="[{type:'confirm',text: '确认取货'}]"
v-if="detail.send_type == 1">
</fix-bottom-button>
<fix-bottom-button @confirm="toChangeOrder('confirm_send_item')" :text="[{type:'confirm',text: '立即发货'}]"
v-if="detail.send_type == 2">
</fix-bottom-button>
</block>
<common-popup @confirm="confirmChangeOrder" ref="confirm_get_item" title="确认取货" desc="请确认是否取货,确认后将无法恢复"
text="确认取货" :info="popupInfo">
</common-popup>
<common-popup @confirm="confirmChangeOrder" ref="confirm_send_item" title="立即发货" desc="请确认是否发货,确认后将无法恢复"
text="确认发货" :info="popupInfo">
</common-popup>
</view>
</template>
<script>
import {
mapState,
mapActions
} from "vuex"
export default {
components: {},
data() {
return {
scrollTop: 0,
options: {},
detail: {},
payType: {
1: '微信支付',
2: '余额支付',
3: '支付宝支付'
},
statusType: {
'-1': '已取消',
2: '待配送',
3: '配送中',
7: '已完成',
},
orderType: {
1: '认养订单',
2: '土地订单'
},
orderText: {
1: 'claim_order',
2: 'land_order'
},
sendType: {
1: '自提',
2: '快递'
},
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.options = options
this.$util.showLoading()
this.initIndex()
},
onPageScroll(e) {
this.scrollTop = e.scrollTop
},
methods: {
...mapActions(['getConfigInfo']),
async initIndex() {
let {
id,
type
} = this.options
let methodModel = type == 1 ? 'claim' : 'land'
let data = await this.$api[methodModel].sendOrderInfo({
id
})
this.detail = data
this.$util.hideAll()
},
initRefresh() {
this.initIndex()
},
async toMap() {
let {
lat,
lng,
address
} = this.detail
await this.$util.checkAuth({
type: 'userLocation'
})
await uni.getLocation({
type: 'gcj02',
})
await uni.openLocation({
latitude: lat * 1,
longitude: lng * 1,
name: address,
scale: 28
})
},
// 确认取货/开始配送/配送到家
async toChangeOrder(key) {
let {
id,
order_code,
} = this.detail
this.popupInfo = {
id,
name: `订单编号:${order_code}`,
image: '',
refs_key: key
}
this.$refs[key].open()
},
async confirmChangeOrder() {
let {
id,
refs_key
} = this.popupInfo
if (this.lockTap) return;
this.lockTap = true;
this.$util.showLoading()
let methodModel = {
'confirm_get_item': {
method: 'sendOrderPickup',
msg: '取货成功'
},
'confirm_send_item': {
method: 'sendOrderSend',
msg: '发货成功'
}
}
let {
method,
msg,
} = methodModel[refs_key]
try {
await this.$api.farmer[method]({
id
})
this.$util.hideAll()
this.$util.showToast({
title: msg
})
this.initRefresh()
this.$util.back()
this.lockTap = false
this.$refs[refs_key].close()
} catch (e) {
setTimeout(() => {
this.lockTap = false
this.$util.hideAll()
}, 2000)
}
},
}
}
</script>
<style lang="scss">
.farmer-order-distribution-detail {
.order-seed-item {
.seed-img {
width: 80rpx;
height: 80rpx;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
}
}
}
</style>

View File

@@ -0,0 +1,282 @@
<template>
<view class="farmer-order-distribution-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 f-paragraph c-title radius-16 box-shadow"
v-for="(item,index) in list.data" :key="index">
<view class="flex-between pb-lg b-1px-b">
<view class="c-desc max-500 ellipsis">配送单号{{item.order_code}}</view>
<view :style="{color:item.pay_type == 2? subColor: item.pay_type == 3? primaryColor: ''}">
{{statusType[item.pay_type]}}
</view>
</view>
<view class="flex-warp mt-lg">
<view class="text-item c-desc">订单类型</view>
<view class="flex-1">{{orderType[item.type]}}</view>
</view>
<view class="flex-warp mt-md">
<view class="text-item c-desc">{{item.send_type == 1 ? '自提时间':'送货时间'}}</view>
<view class="flex-1">{{item.time_text}}</view>
</view>
<view class="flex-warp mt-md">
<view class="text-item c-desc">配送方式</view>
<view class="flex-1">{{sendType[item.send_type]}}</view>
</view>
<view class="flex-warp mt-md" v-if="item.send_type == 2">
<view class="text-item c-desc">收货地址</view>
<view class="flex-1">{{item.address}}</view>
</view>
<view class="flex-warp mt-md">
<view class="text-item c-desc">{{item.send_type==1?'自提人':'收货人'}}</view>
<view class="flex-1">{{`${item.user_name} ${item.mobile}`}}</view>
</view>
<view class="flex-warp pt-lg" v-if="item.pay_type > 2 && item.send_type == 2">
<view class="text-item c-desc">发货时间</view>
<view class="flex-1">{{item.send_time}}</view>
</view>
<view class="flex-warp pt-lg" v-if="item.pay_type == 7">
<view class="text-item c-desc">{{item.send_type == 1 ? '取货时间':'收货时间'}}</view>
<view class="flex-1">{{item.receiving_time}}</view>
</view>
<view class="mt-md" v-if="item.text">
<view class="text-item c-desc">备注</view>
<view class="mt-sm">
<text decode="emsp" style="word-break:break-all;">{{item.text}}</text>
</view>
</view>
<block v-if="item.send_type == 2">
<view class="flex-warp pt-lg">
<view class="text-item c-desc">付款单号</view>
<view class="flex-1">{{item.transaction_id}}</view>
</view>
<view class="flex-warp pt-lg" v-if="item.pay_type == -1">
<view class="text-item c-desc">退款单号</view>
<view class="flex-1">{{item.refund_code}}</view>
</view>
<view class="flex-warp mt-md">
<view class="text-item c-desc">配送费</view>
<view class="flex-1 flex-y-center c-warning">
<view>¥{{item.pay_price}}</view>
<view class="ml-sm" v-if="item.pay_type == -1">(已退)</view>
</view>
</view>
</block>
<view class="flex-between mt-md" v-if="item.pay_type == 2">
<view></view>
<view @tap.stop="toChangeOrder(index,item.send_type==1?'confirm_get_item':'confirm_send_item')"
class="common-btn flex-center f-caption c-base radius-4 ml-lg" :style="{background:primaryColor}">
{{item.send_type == 1?'确认取货':'立即发货'}}
</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>
<common-popup @confirm="confirmChangeOrder" ref="confirm_get_item" title="确认取货" desc="请确认是否取货,确认后将无法恢复"
text="确认取货" :info="popupInfo">
</common-popup>
<common-popup @confirm="confirmChangeOrder" ref="confirm_send_item" title="立即发货" desc="请确认是否发货,确认后将无法恢复"
text="确认发货" :info="popupInfo">
</common-popup>
</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: '已完成'
}, {
id: -1,
title: '已取消'
}],
statusType: {
'-1': '已取消',
2: '待配送',
3: '配送中',
7: '已完成',
},
orderType: {
1: '认养订单',
2: '土地订单'
},
sendType: {
1: '自提',
2: '快递'
},
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()
this.options = options
let {
tab = 0
} = 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.farmerSendOrderList(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.no_send
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()
},
// 确认取货/开始配送/配送到家
async toChangeOrder(index, key) {
let {
id,
order_code,
} = this.list.data[index]
this.popupInfo = {
id,
name: `订单编号:${order_code}`,
image: '',
index,
refs_key: key
}
this.$refs[key].open()
},
async confirmChangeOrder() {
let {
id,
index,
refs_key
} = this.popupInfo
if (this.lockTap) return;
this.lockTap = true;
this.$util.showLoading()
let methodModel = {
'confirm_get_item': {
method: 'sendOrderPickup',
msg: '取货成功'
},
'confirm_send_item': {
method: 'sendOrderSend',
msg: '发货成功'
}
}
let {
method,
msg,
} = methodModel[refs_key]
try {
await this.$api.farmer[method]({
id
})
this.$util.hideAll()
this.$util.showToast({
title: msg
})
this.lockTap = false
this.$refs[refs_key].close()
this.initRefresh()
} catch (e) {
setTimeout(() => {
this.lockTap = false
this.$util.hideAll()
}, 2000)
}
},
// 订单详情
goDetail(index) {
let {
id,
type
} = this.list.data[index]
let url = `/farmer/pages/order/distribution/detail?id=${id}&type=${type}`
this.$util.goUrl({
url
})
}
}
}
</script>
<style lang="scss">
</style>