pad-app/pages/index/index.vue

381 lines
9.0 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">
<text v-if="item.vvyStatus==0" class="nStarted"> {{item.vvyStatusName}}</text>
<text v-if="item.vvyStatus==1" class="green"> {{item.vvyStatusName}}</text>
<text v-if="item.vvyStatus==2" class="complete"> {{item.vvyStatusName}}</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.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-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>
2023-11-13 18:02:20 +08:00
<LotusLoading :lotusLoadingData="lotusLoadingData"></LotusLoading>
2023-07-03 17:49:29 +08:00
</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-11-13 18:02:20 +08:00
import LotusLoading from "../../components/Winglau14-lotusLoading/Winglau14-LotusLoading.vue";
2023-07-21 17:28:30 +08:00
let timers = null;
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-07 18:02:20 +08:00
pageSize: 9,
2023-09-23 20:16:54 +08:00
current: 1,
// 港区信息
2023-11-13 18:02:20 +08:00
portObj: {},
lotusLoadingData: {
isShow: false //设置显示加载中组件true显示false隐藏
}
2023-09-23 20:16:54 +08:00
}
},
2023-11-13 18:02:20 +08:00
components: {
HeadInfo,
LotusLoading
},
2023-11-13 10:11:34 +08:00
onReachBottom() {
this.current++
this.initData()
2023-11-13 18:02:20 +08:00
this.lotusLoadingData.isShow = 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-07-21 17:28:30 +08:00
},
2023-11-13 10:11:34 +08:00
// 选择船输入框
shipInput(e) {
this.shipValue = e
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) => {
2023-11-13 10:11:34 +08:00
console.log(res)
2023-09-23 20:16:54 +08:00
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-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-11-13 18:02:20 +08:00
this.lotusLoadingData.isShow = 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;
justify-content: flex-end;
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-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-08-18 17:28:11 +08:00
margin-right: 15px;
2023-11-13 10:11:34 +08:00
margin-top: 8px;
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-13 10:11:34 +08:00
margin-top: 8px;
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;
justify-content: flex-start;
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-11-07 18:02:20 +08:00
gap: 16px;
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-07 18:02:20 +08:00
width: 32.2%;
2023-09-23 20:16:54 +08:00
background-color: #fff;
border-radius: 8px;
2023-11-07 18:02:20 +08:00
padding: 10px 20px;
2023-09-23 20:16:54 +08:00
position: relative;
2023-07-06 17:08:59 +08:00
2023-07-05 10:56:11 +08:00
.title {
display: flex;
2023-09-23 20:16:54 +08:00
padding: 10px 0;
2023-07-05 10:56:11 +08:00
justify-content: space-between;
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: 14px;
padding: 10px 0;
font-size: 16px;
2023-07-06 17:08:59 +08:00
.nitem {
2023-11-13 10:11:34 +08:00
// width: 49%;
2023-07-06 17:08:59 +08:00
2023-09-23 20:16:54 +08:00
.text {
2023-07-06 17:08:59 +08:00
color: #929292;
}
2023-07-05 10:56:11 +08:00
}
2023-11-13 10:11:34 +08:00
.nitem:nth-of-type(2n) {
width: 35%;
}
.nitem:nth-of-type(2n - 1) {
width: 63%;
}
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 {
margin-top: 5px;
font-size: 16px;
.nStarted {
color: #bbb;
}
.complete {
color: #0067CF;
}
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>