emis-sapp/pages/tabBar/search/search.vue
2024-10-29 23:14:43 +08:00

312 lines
9.5 KiB
Vue

<template>
<tpx-page>
<tpx-layout>
<template v-slot:header>
<view class="search_nav_bar">
<view class="com-jianju" style="width: 490rpx;">
<tpx-navigation-height>
<!-- 关键字搜索框 -->
<tpx-search placeholder="请输入运单号/订单号" v-model:value="searchParam.billCode" @change="handleSearch" bgColor="#FFF" :timelyTrigger="false"></tpx-search>
</tpx-navigation-height>
</view>
<view class="com-jianju" style="padding-top: 40rpx;">
<u-row justify="between" align="top">
<u-col span="9">
<!-- 订单状态 -->
<tpx-tabs :list="dicData.emis_oms_order_tab" v-model:value="searchParam.params.omsOrderTab"
mode="info" v-slot="curOrdTab"
>
<text slot>
<!-- (<text>{{curOrdTab.item.val}}</text>) -->
</text>
</tpx-tabs>
</u-col>
<u-col span="2">
<!-- 更多查询条件 -->
<u-button @click="handleDialogClick(moreSearchModel)" :hairline="false" shape="circle" size="mini" custom-style="border-radius: 23rpx;font-size: 26rpx;height: 50rpx;">
<u-row justify="center">
<view :style="'padding-right: 4rpx;white-space: nowrap;' + (hasExtSchParam?'color: #B12D29;':'color: #666;')">
{{hasExtSchParam?'已':''}}筛选
</view>
<u-icon :name="moreSearchModel.show?'arrow-up-fill':'arrow-down-fill'"
:color="(hasExtSchParam?'#B12D29':'#666')" size="18" custom-style="margin-top: 2rpx;"
></u-icon>
</u-row>
</u-button>
</u-col>
</u-row>
</view>
<!-- 状态搜索 -->
<view v-if="moreSearchModel.show" class="search-more-panel">
<view class="smp-body slideInDown animated fast">
<view class="smp-content">
<view class="pos-abt-all" style="overflow-y: auto;">
<view style="padding: 0 0 30rpx 0">
<view>
<u-text text="快递状态" size="28" :bold="true" margin="0 0 20rpx 0"></u-text>
<tpx-tags :list="dicData.emis_order_status" v-model:value="moreSearchModel.data.params.orderStatType" ></tpx-tags>
</view>
<view>
<u-text text="付款方式" size="28" :bold="true" margin="20rpx 0 20rpx 0"></u-text>
<tpx-tags :list="dicData.emis_payment_type" v-model:value="moreSearchModel.data.params.paymentType" ></tpx-tags>
</view>
<view>
<u-text text="时间范围" size="28" :bold="true" margin="20rpx 0 20rpx 0"></u-text>
<tpx-date-input v-model:value="moreSearchModel.data._date" placeholder="请选择时间"></tpx-date-input>
</view>
</view>
</view>
</view>
<view class="smp-foot">
<u-row gutter="20" justify="between">
<u-button @click="handleResetTempSearch()" shape="circle">重置</u-button>
<view style="width: 40rpx;"></view>
<u-button @click="handleConfirmTempSearch()" shape="circle" type="primary">确认</u-button>
</u-row>
</view>
</view>
</view>
</view>
</template>
<template v-slot:body>
<view v-if="!baseLoading" class="pos-abt-all">
<tpx-scroll-view v-model:resObject="resData" :searchParam="searchParam" :getListFun="getListFun"
ref="listRef"
>
<view class="pgb-cont">
<!-- 列表数据 -->
<view v-for="(item) in resData.list" class="ord-list-item">
<view class="mt-10">
<bpd-send-reciever-tmp :value="item" :showInfoBtn="false"></bpd-send-reciever-tmp>
</view>
<u-line color="#DEDEDE" margin="30rpx 0 0 0"></u-line>
<u-row justify="end" custom-style="margin-top:20rpx;">
<view style="display: inline-block;white-space: nowrap;">
<u-row>
<!-- 仓库收货(待揽收): -->
<u-button v-if="(item.orderStatus == 1 && item.waybillStatus == 0)"
@click="handleDealItem(item, { type: 4 })" shape="circle" type="primary" :plain="true"
custom-style="height: 54rpx;margin-left: 12rpx;">进仓确认</u-button>
<!-- 待接单 -->
<u-button v-if="(item.orderStatus == 0)"
@click="handleDealItem(item, { type: 2 })" shape="circle" type="primary"
custom-style="height: 54rpx;margin-left: 12rpx;">再来一单</u-button>
<!-- 待接单 -->
<u-button v-if="(item.orderStatus == 0)"
@click="handleDealItem(item, { type: 3 })" shape="circle" type="primary"
:plain="true" custom-style="height: 54rpx;margin-left: 12rpx;">取消</u-button>
<!-- 待付款 -->
<u-button v-if="(item.paymentStatus == 0)"
@click="handleDealItem(item, { type: 5 })" shape="circle" type="primary" :plain="true"
custom-style="height: 54rpx;margin-left: 12rpx;">去付款</u-button>
</u-row>
</view>
</u-row>
</view>
</view>
</tpx-scroll-view>
</view>
</template>
</tpx-layout>
<tpx-com-dialog v-model:show="cancelModal.show" ref="cancelRef" title="确认取消">
<template v-slot:body>
<u-textarea v-model="cancelModal.data.orderRemark" border="surround" height="120" placeholder="请输入"
maxlength="300" count></u-textarea>
</template>
</tpx-com-dialog>
</tpx-page>
</template>
<script>
import * as apiService from "@/common/api"
import BpdSendRecieverTmp from "@/components/buns-post-detail-templates/bpd-send-reciever-tmp"
import { deepAssign } from "@/common/util"
export default {
props: {
},
computed: {
dicData() {
return this.$store.getters.dicData
},
hasExtSchParam() {
let hasExt = false
if(
this.searchParam._date.length > 0
|| this.searchParam.params.paymentType
|| this.searchParam.params.orderStatType
) {
hasExt = true
}
return hasExt
},
},
components: { BpdSendRecieverTmp },
data() {
let { dicData } = this.$store.getters
return {
baseLoading: true,
showCladar: false,
moreSearchModel: {
data: {},
show: false
},
cancelModal: {
show: false,
data: {
orderRemark: ''
}
},
searchParam: {
billCode: '',
_date: [],
params: {
omsOrderTab: dicData.emis_oms_order_tab?.[0]?.val,
orderStatType: '',
paymentType: '',
}
},
queryOption: {
orderTab: '',
},
resData: { list: [] }
}
},
onShareAppMessage() {
},
onShow(){
this.triggerListReload()
this.initData()
},
onLoad(option) {
this.queryOption = option
if(typeof this.queryOption.orderTab != 'undefined') {
this.searchParam.params.omsOrderTab = this.queryOption.orderTab
}
// 保证参数初始化成功后
this.baseLoading = false
},
onUnload() {
},
methods: {
transSearchPm(param){
let cpParam = JSON.parse(JSON.stringify(param))
cpParam.params.beginDate = cpParam?._date?.[0]
cpParam.params.endDate = cpParam?._date?.[1]
return cpParam
},
async getListFun(param){
let cpParam = this.transSearchPm(param)
let res = await apiService.getOrderList(cpParam)
return res
},
initData(){
},
async handleDealItem(item, deal = { type: '1' }) {
let itemQuery = `?billCode=${item.billCode || ''}&orderSn=${item.orderSn || ''}`
switch (deal.type){
case 1: // 运单详情
this.goto(`post/detail${itemQuery}`)
break;
case 2: // 再来一单
this.goto(`post/post?copyBillCode=${item.billCode}`)
break;
case 3: // 取消
let canBl = await this.$refs.cancelRef.getConfirmResult()
if(canBl) {
await apiService.cancelOrder({ orderSn: item.orderSn, ...this.cancelModal.data })
this.triggerListReload()
}
this.cancelModal.data = { }
this.cancelModal.show = false
break;
case 4: // 进仓确认
this.goto(`warehousing/detail${itemQuery}&inNo=${item.intoWarehouseBillCode}`)
break;
case 5: // 付款
this.goto(`bill/detail${itemQuery}`)
break;
default:
break;
}
},
handleSearch(){
setTimeout(()=> {
this.triggerListReload()
}, 300)
},
triggerListReload(){
this?.$refs?.listRef?.getDataList?.(true) // 重置到第一页数据
},
handleDialogClick(curModal){
this.moreSearchModel.data = JSON.parse(JSON.stringify(this.searchParam))
this.moreSearchModel.show = !this.moreSearchModel.show
},
handleResetTempSearch(){
let data = this.moreSearchModel.data
data._date = []
data.params.orderStatType = ''
data.params.paymentType = ''
},
handleConfirmTempSearch(){
deepAssign(this.searchParam, this.moreSearchModel.data)
this.moreSearchModel.show = false
}
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
.search_nav_bar {
background-color: #B12D29;
position: relative;
}
</style>
<style scoped lang="scss">
.pgb-cont{
padding: 30rpx 30rpx 0 30rpx;
}
.ord-list-item{
box-shadow: 0rpx 3rpx 12rpx 0rpx rgba(139,139,139,0.06);
border-radius: 20rpx;
padding: 22rpx 30rpx;
background-color: #fff;
margin-bottom: 30rpx;
}
.search-more-panel{
overflow: hidden;
position: absolute;
left: 0;
right: 0;
height: calc(70vh);
z-index: 200;
}
.smp-body{
padding: 30rpx;
display: flex;
flex-direction: column;
height: 100%;
background-color: #FFF;
border-radius: 0 0 30rpx 30rpx;
box-sizing: border-box;
}
.smp-content{
flex: 1;
position: relative;
}
</style>