pad-app/pages/index/index.vue

395 lines
9.2 KiB
Vue
Raw Normal View History

2023-07-03 17:49:29 +08:00
<template>
<view class="app">
2023-08-18 17:28:11 +08:00
<head-info :navIndex="0"></head-info>
2023-07-03 17:49:29 +08:00
<view class="container">
<view class="content">
<view class="form">
2023-07-06 17:08:59 +08:00
<view class="end">
2023-09-23 20:16:54 +08:00
<superwei-combox class="input" :candidates="tradeList" :isJSON="true" keyName="name"
placeholder="请选择贸易类型" v-model="tradeName" @select="tradeSelect"></superwei-combox>
</uni-easyinput>
<superwei-combox class="input" :candidates="shipList" :isJSON="true" keyName="vvyShip"
2023-11-13 10:11:34 +08:00
placeholder="请选择船名/航次" v-model="vvyShip" @select="shipSelect"
@input="shipInput"></superwei-combox>
2023-07-06 17:08:59 +08:00
</uni-easyinput>
2023-07-21 17:28:30 +08:00
<button class="btn" @click="onSearch"></button>
2023-07-06 17:08:59 +08:00
</view>
2023-07-03 17:49:29 +08:00
</view>
<view class="itemList">
2023-09-23 20:16:54 +08:00
<template v-if="itemList.length > 0">
<view v-for="(item, index) in itemList" :key="index" class="item">
<view @click="toDetails(item)">
<view class="title">
<view class="titleft">
<image src="../../static/images/ship.png" mode="widthFix"></image>
<view class="name">
{{item.spmIdDesc}}
</view>
</view>
<view class="status">
2023-12-22 17:48:52 +08:00
<p v-if="item.vvyStatus==0" class="dfs">{{item.vvyStatusName}}</p>
<p v-if="item.vvyStatus==1" class="zyz">{{item.vvyStatusName}}</p>
<p v-if="item.vvyStatus==2" class="ywc">{{item.vvyStatusName}}</p>
2023-09-23 20:16:54 +08:00
</view>
2023-07-06 17:08:59 +08:00
</view>
2023-09-23 20:16:54 +08:00
<view class="row">
<view class="nitem">
航次: <text>{{item.vvyName}}</text>
</view>
<view class="nitem">
贸易类型: <text>{{item.tradeType}}</text>
</view>
2023-07-06 17:08:59 +08:00
</view>
2023-09-23 20:16:54 +08:00
<view class="row">
<view class="nitem">
进出口: <text>{{item.importExportFlag}}</text>
</view>
<view class="nitem">
泊位: <text>{{item.actualBerthageDesc}}</text>
</view>
2023-07-06 17:08:59 +08:00
</view>
</view>
</view>
2023-12-22 17:48:52 +08:00
<template v-if="isMore">
<uni-load-more iconType="circle" status="loading" style="width: 100%;" />
</template>
2023-09-23 20:16:54 +08:00
</template>
<o-empty v-else height="70vh" bg="#f5f6fa" />
</view>
2023-11-13 10:11:34 +08:00
<!-- <view class="pageBox" v-if="itemList.length > 0">
2023-09-23 20:16:54 +08:00
<uni-pagination :show-icon="true" :total="total" :pageSize="pageSize" :current="current"
@change="changePage" />
2023-11-13 10:11:34 +08:00
</view> -->
2023-07-03 17:49:29 +08:00
</view>
</view>
</view>
</template>
<script>
import HeadInfo from '@/components/head-info/head-info';
2023-09-23 20:16:54 +08:00
import api from "../../common/api.js"
2023-07-03 17:49:29 +08:00
export default {
data() {
return {
2023-09-23 20:16:54 +08:00
loginObj: {},
itemList: [],
tradeName: "外贸",
tradeType: "W",
tradeItem: {},
tradeList: [{
value: "1",
2023-11-07 18:02:20 +08:00
name: "外贸"
2023-09-23 20:16:54 +08:00
},
{
value: "2",
2023-11-07 18:02:20 +08:00
name: "内贸"
2023-09-23 20:16:54 +08:00
}
],
vvyShip: "",
vvyId: "",
shipId: "",
2023-07-21 17:28:30 +08:00
shipName: '',
2023-11-13 10:11:34 +08:00
shipValue: "",
2023-09-23 20:16:54 +08:00
shipList: [],
// 分页
total: 0,
2023-11-16 18:04:18 +08:00
pageSize: 12,
2023-09-23 20:16:54 +08:00
current: 1,
// 港区信息
2023-11-13 18:02:20 +08:00
portObj: {},
2023-12-22 17:48:52 +08:00
isMore: false,
2023-09-23 20:16:54 +08:00
}
},
2023-11-13 18:02:20 +08:00
components: {
HeadInfo,
},
2023-11-13 10:11:34 +08:00
onReachBottom() {
this.current++
this.initData()
2023-12-22 17:48:52 +08:00
this.isMore = true
2023-11-13 10:11:34 +08:00
},
2023-09-23 20:16:54 +08:00
onLoad() {
this.portObj = uni.getStorageSync('portObj')
this.loginObj = uni.getStorageSync('loginObj')
this.getShip()
},
onBackPress(options) {
// 触发返回就会调用此方法,这里实现的是禁用物理返回,顶部导航栏的自定义返回 uni.navigateBack 仍可使用
if (options.from == 'backbutton') {
return true;
} else if (options.from == 'navigateBack') {
return false;
2023-07-03 17:49:29 +08:00
}
},
2023-11-01 18:40:05 +08:00
mounted() {
this.initData()
},
2023-07-03 17:49:29 +08:00
methods: {
2023-09-23 20:16:54 +08:00
// 切换贸易类型
tradeSelect(e) {
this.tradeItem = e
this.tradeName = e.name
this.shipId = ""
this.shipName = ""
this.vvyId = ""
this.vvyShip = ""
this.getShip()
2023-07-21 17:28:30 +08:00
},
2023-09-23 20:16:54 +08:00
// 选择船
2023-07-21 17:28:30 +08:00
shipSelect(e) {
2023-09-23 20:16:54 +08:00
this.shipId = e.spmId
this.shipName = e.vslCnname
this.vvyId = e.vvyId
this.vvyShip = e.vvyShip
2023-11-24 15:55:58 +08:00
this.getShip()
2023-07-21 17:28:30 +08:00
},
2023-11-13 10:11:34 +08:00
// 选择船输入框
shipInput(e) {
this.shipValue = e
2023-11-21 17:43:02 +08:00
if (e == "") {
this.vvyId = ""
this.vvyShip = ""
this.shipId = ""
this.shipName = ""
}
2023-11-13 10:11:34 +08:00
this.getShip()
},
2023-07-21 17:28:30 +08:00
// 获取船舶
2023-09-23 20:16:54 +08:00
getShip() {
if (this.tradeName == '外贸') {
this.tradeType = "W"
} else {
this.tradeType = "N"
}
let ieType = "E"
let key = ""
let spmId = ""
uni.request({
2023-11-13 10:11:34 +08:00
url: `${this.$local}/api/shipInstructions/queryByKey?ieType=${ieType}&key=${this.shipValue}&pamId=${this.portObj.portId}&spmId=${spmId}&tradeType=${this.tradeType}`,
2023-09-23 20:16:54 +08:00
header: {
'Content-Type': 'application/json', //自定义请求头信息
'Authorization': `Bearer ${this.loginObj.access_token}`
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
if (res.data.status == "200") {
this.shipList = res.data.data
this.shipList.forEach(v => {
let vvyShip = `${v.vslCnname}/${v.vvyName}`
this.$set(v, "vvyShip", vvyShip)
})
}
}
2023-07-21 17:28:30 +08:00
})
},
2023-09-23 20:16:54 +08:00
// 点击搜索
2023-07-21 17:28:30 +08:00
onSearch() {
2023-12-14 17:02:53 +08:00
this.current = 1
2023-11-13 18:02:20 +08:00
this.itemList = []
2023-09-23 20:16:54 +08:00
this.initData()
2023-07-21 17:28:30 +08:00
},
2023-09-23 20:16:54 +08:00
initData() {
let url = ""
if (this.tradeName == '内贸') {
url =
2023-11-01 18:40:05 +08:00
`${this.$local}/api/domestic/load/command/queryLoadVoyages?pamId=${this.portObj.portId}&vvyId=${this.vvyId}&size=${this.pageSize}&current=${this.current}`
2023-09-23 20:16:54 +08:00
} else if (this.tradeName == '外贸') {
url =
2023-11-01 18:40:05 +08:00
`${this.$local}/api/shipInstructions/queryStowageVoyages?pamId=${this.portObj.portId}&vvyId=${this.vvyId}&tradeType=${this.tradeType}&size=${this.pageSize}&current=${this.current}`
2023-09-23 20:16:54 +08:00
}
uni.request({
url: url,
header: {
'Content-Type': 'application/json', //自定义请求头信息
'Authorization': `Bearer ${this.loginObj.access_token}`
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
2023-12-22 17:48:52 +08:00
this.isMore = false
2023-11-01 18:40:05 +08:00
this.total = res.data.data.total
2023-11-13 10:11:34 +08:00
this.itemList.push(...res.data.data.records)
2023-09-23 20:16:54 +08:00
}
2023-07-06 17:08:59 +08:00
})
2023-07-13 17:21:12 +08:00
},
2023-09-23 20:16:54 +08:00
// 点击分页
changePage(e) {
this.current = e.current;
this.initData()
},
toDetails(item) {
let obj = {
shipInfo: item,
}
const params = encodeURIComponent(JSON.stringify(obj));
if (this.tradeName == '外贸') {
uni.navigateTo({
url: '/pages/index/instruct?params=' + params
})
} else {
uni.navigateTo({
url: '/pages/index/domesticTrade?params=' + params
})
}
},
2023-07-03 17:49:29 +08:00
}
};
</script>
2023-09-23 20:16:54 +08:00
<style lang="less" scoped>
2023-07-03 17:49:29 +08:00
.content {
padding: 20px;
2023-09-23 20:16:54 +08:00
min-height: calc(100vh - 68px - 40px);
2023-11-13 10:11:34 +08:00
margin-top: 66px;
margin-bottom: 20px;
2023-07-03 17:49:29 +08:00
.form {
2023-11-13 10:11:34 +08:00
width: 100%;
height: 50px;
background: #f5f6fa;
2023-07-03 17:49:29 +08:00
display: flex;
2023-11-13 10:11:34 +08:00
position: fixed;
top: 66px;
right: 0;
2023-11-13 18:02:20 +08:00
z-index: 995;
2023-12-22 17:48:52 +08:00
padding-left: 20px;
2023-07-03 17:49:29 +08:00
2023-07-06 17:08:59 +08:00
.end {
display: flex;
justify-content: space-between;
.input {
width: 200px;
height: 35px;
line-height: 35px;
padding-left: 10px;
2023-12-22 17:48:52 +08:00
margin: 10px 15px 0 0;
2023-07-06 17:08:59 +08:00
}
2023-07-21 17:28:30 +08:00
.btn {
height: 35px;
line-height: 35px;
2023-09-23 20:16:54 +08:00
margin-left: 0;
font-size: 16px;
color: #fff;
background-color: #0067CF;
margin-right: 10px;
2023-11-21 17:43:02 +08:00
margin-top: 10px;
2023-07-21 17:28:30 +08:00
}
2023-07-03 17:49:29 +08:00
}
2023-07-06 17:08:59 +08:00
2023-07-03 17:49:29 +08:00
}
.itemList {
width: 100%;
display: flex;
2023-11-16 18:04:18 +08:00
// justify-content: space-between;
2023-07-03 17:49:29 +08:00
flex-wrap: wrap;
2023-09-23 20:16:54 +08:00
position: relative;
2023-11-13 10:11:34 +08:00
margin-top: 40px;
2023-12-22 17:48:52 +08:00
padding-bottom: 50px;
2023-09-23 20:16:54 +08:00
/deep/.o-empty {
width: 100%;
}
2023-07-06 17:08:59 +08:00
2023-07-03 17:49:29 +08:00
.item {
2023-11-16 18:04:18 +08:00
width: calc(33.3% - 16px);
2023-09-23 20:16:54 +08:00
background-color: #fff;
border-radius: 8px;
2023-12-22 17:48:52 +08:00
padding: 16px;
2023-09-23 20:16:54 +08:00
position: relative;
2023-11-16 18:04:18 +08:00
margin-bottom: 16px;
margin-right: 16px;
2023-07-06 17:08:59 +08:00
2023-07-05 10:56:11 +08:00
.title {
display: flex;
justify-content: space-between;
2023-12-22 17:48:52 +08:00
margin-bottom: 24px;
2023-07-06 17:08:59 +08:00
2023-09-23 20:16:54 +08:00
.titleft {
display: flex;
}
image {
width: 32px;
height: 32px;
margin-right: 12px;
}
2023-07-06 17:08:59 +08:00
2023-09-23 20:16:54 +08:00
.name {
margin-top: 5px;
font-size: 16px;
color: #23262E;
font-weight: bold;
}
}
2023-07-06 17:08:59 +08:00
2023-07-05 10:56:11 +08:00
.row {
display: flex;
justify-content: space-between;
2023-09-23 20:16:54 +08:00
font-size: 16px;
2023-12-22 17:48:52 +08:00
margin-bottom: 12px;
2023-07-06 17:08:59 +08:00
.nitem {
2023-12-22 17:48:52 +08:00
width: 49%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #999;
2023-07-06 17:08:59 +08:00
2023-12-22 17:48:52 +08:00
text {
color: #23262e;
2023-07-06 17:08:59 +08:00
}
2023-07-05 10:56:11 +08:00
}
2023-09-23 20:16:54 +08:00
}
2023-07-06 17:08:59 +08:00
2023-09-23 20:16:54 +08:00
.status {
font-size: 16px;
2023-12-22 17:48:52 +08:00
position: absolute;
right: 0;
top: 23px;
2023-09-23 20:16:54 +08:00
2023-12-22 17:48:52 +08:00
p {
padding: 5px;
border-radius: 13px 0 0 13px;
2023-09-23 20:16:54 +08:00
}
2023-12-22 17:48:52 +08:00
.dfs {
2023-09-23 20:16:54 +08:00
color: #0067CF;
2023-12-22 17:48:52 +08:00
background: #F1F8FF;
}
.zyz {
color: #04B578;
background: #E8FFF7;
}
.ywc {
color: #666666;
background: #F7F7F7;
2023-09-23 20:16:54 +08:00
}
2023-07-05 10:56:11 +08:00
}
2023-07-03 17:49:29 +08:00
}
2023-07-06 17:08:59 +08:00
2023-07-03 17:49:29 +08:00
.item:nth-child(3n) {
margin-right: 0;
}
}
2023-09-23 20:16:54 +08:00
.pageBox {
2023-11-13 10:11:34 +08:00
width: 100%;
height: 50px;
background-color: #fff;
2023-09-23 20:16:54 +08:00
margin-top: 20px;
2023-11-13 10:11:34 +08:00
position: fixed;
bottom: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
2023-09-23 20:16:54 +08:00
}
2023-07-03 17:49:29 +08:00
}
2023-07-13 17:21:12 +08:00
</style>