shipSchedule.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!-- 船期查询 -->
  2. <template>
  3. <view>
  4. <!-- 搜索区 -->
  5. <view style="width: 80%;margin: 10rpx auto;">
  6. <!-- <u-field v-model="polId" label="起始港" placeholder="请选择起始港" type="select" @click="destination = true"></u-field> -->
  7. <u-navbar title="船期查询" :background="{ background: '#1669e6' }" title-color="#fff" back-icon-color="#fff"></u-navbar>
  8. <u-form-item label="起始港" label-width="100rpx">
  9. <u-input v-model="list.polId" type="select" placeholder="请选择起始港" @click="popup(0)" />
  10. </u-form-item>
  11. <u-popup v-model="destination" width="100%">
  12. <u-navbar :custom-back="portSelection">
  13. <u-search placeholder="请输入港口" v-model="formPort.fName" @search="searchPort" @custom="searchPort">
  14. </u-search>
  15. </u-navbar>
  16. <u-cell-group>
  17. <u-cell-item v-for="(item,index) in portList" :key="index" :title="item.fName" @click="confirmSelection(item)"></u-cell-item>
  18. </u-cell-group>
  19. <!-- <u-loadmore :status="status" :load-text="loadText" /> -->
  20. </u-popup>
  21. <!-- <u-action-sheet :list="destinationList" v-model="destination" @click="destinationMethod"></u-action-sheet> -->
  22. <u-form-item label="目的港" label-width="100rpx">
  23. <u-input v-model="list.podId" type="select" placeholder="请选择目的港" @click="popup(1)" />
  24. </u-form-item>
  25. <u-action-sheet :list="destinationList" v-model="destinationtwo" @click="destinationMethodTwo">
  26. </u-action-sheet>
  27. <u-form-item label="开航日" label-width="100rpx">
  28. <u-input v-model="list.sailingDay" :disabled="true" type="select" placeholder="请选择日期"
  29. @click="show = true" />
  30. </u-form-item>
  31. <u-calendar max-date="2050" v-model="show" mode="range" @change="change"></u-calendar>
  32. </view>
  33. <!-- <view
  34. style="width: 100%;position:fixed; bottom:0;background-color: #FFFFFF;padding-left: 20px;padding-right: 20px;padding-bottom: 30rpx;">
  35. <u-button type="primary" @click="submit">确认查询</u-button>
  36. </view> -->
  37. <view style="width: 90%;margin: 40rpx auto;">
  38. <u-button type="primary" @click="submit">确认查询</u-button>
  39. </view>
  40. <!-- 历史记录区 -->
  41. <view v-if="historyList > 0">
  42. <view
  43. style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);width: 96%;border-top-right-radius: 10rpx;margin: 0 auto;">
  44. <view style="width: 90%;margin: 0 auto;height: 80rpx;margin: 0 auto;line-height: 80rpx;">
  45. <view style="float: left;">历史记录</view>
  46. <view style="color: #279cfd;float: right;" @click="deleteAll()">清除全部</view>
  47. </view>
  48. <view
  49. style="width: 100%;height: 80rpx;margin: 0 auto;line-height: 80rpx;padding: 0 5% 0 5%;border-top: 1rpx solid #eff4ff;"
  50. v-for="(item,index) in historyList" :key="index">
  51. <view style="float: left;">{{item.fPortOriginName}}——{{item.fPortDestinationName}}</view>
  52. <view style="color: #279cfd;float: right;">
  53. <u-icon name="trash" color="#ccc" @click="deleteRecord(item.fId)"></u-icon>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. show: false,
  65. mode: 'range',
  66. total: 0,
  67. // 0为起运港1为目的港
  68. portStatus: '',
  69. status: 'nomore',
  70. loadText: {
  71. loadmore: '轻轻上拉',
  72. loading: '努力加载中',
  73. nomore: '实在没有了'
  74. },
  75. list: {},
  76. portList: [],
  77. form: {
  78. fQueryFrom: 'app',
  79. pageNum: 1,
  80. pageSize: 10,
  81. },
  82. destination: false,
  83. formPort: {
  84. pageNum: 1
  85. },
  86. destinationtwo: false,
  87. destinationList: [],
  88. historyList: []
  89. }
  90. },
  91. created() {
  92. this.destinationList = []
  93. this.$u.get('/shipping/address/selectPortName').then(res => {
  94. for (let item in res.rows) {
  95. this.destinationList.push({
  96. value: res.rows[item].fId,
  97. text: res.rows[item].fName
  98. })
  99. }
  100. })
  101. this.queryPort()
  102. this.history()
  103. },
  104. // onReachBottom() {
  105. // this.status = 'loading'
  106. // if (this.portList.length < this.total) {
  107. // this.formPort.pageNum++
  108. // this.queryPort()
  109. // } else {
  110. // this.status = 'nomore'
  111. // }
  112. // },
  113. methods: {
  114. queryPort() {
  115. console.log(this.formPort)
  116. this.$u.get('/shipping/address/selectPortName', this.formPort).then(res => {
  117. this.portList = this.portList.concat(res.rows)
  118. this.total = res.total
  119. })
  120. },
  121. //查询历史搜索记录
  122. history() {
  123. this.$u.get('/quotation/queryseapricelog/list').then(res => {
  124. this.historyList = res.rows
  125. })
  126. },
  127. change(e) {
  128. console.log(e)
  129. this.form.fValiddateBegin = e.startDate
  130. this.form.fValiddateEnd = e.endDate
  131. this.list.sailingDay = e.startDate + ' - ' + e.endDate
  132. },
  133. portSelection() {
  134. this.destination = false
  135. },
  136. confirmSelection(item) {
  137. this.destination = false
  138. if (this.portStatus == 0) {
  139. this.list.polId = item.fName
  140. this.form.polId = item.fId
  141. } else if (this.portStatus == 1) {
  142. this.list.podId = item.fName
  143. this.form.podId = item.fId
  144. }
  145. },
  146. searchPort() {
  147. this.formPort.pageNum = 1
  148. this.queryPort()
  149. },
  150. popup(item) {
  151. if (item == 0) {
  152. this.portStatus = item
  153. this.destination = true
  154. } else if (item == 1) {
  155. this.portStatus = item
  156. this.destination = true
  157. }
  158. },
  159. destinationMethod(index) {
  160. this.list.polId = this.destinationList[index].text
  161. this.form.polId = this.destinationList[index].value
  162. },
  163. destinationMethodTwo(index) {
  164. this.list.podId = this.destinationList[index].text
  165. this.form.podId = this.destinationList[index].value
  166. },
  167. submit() {
  168. if (!this.form.polId) return this.textTips('请选择起始港')
  169. if (!this.form.podId) return this.textTips('请选择目的港')
  170. if (!this.form.fValiddateBegin || !this.form.fValiddateEnd) return this.textTips('请选择开航日期')
  171. this.$u.route('/pages/home/freightCalculation/shippingInformation', {
  172. form: JSON.stringify(this.form),
  173. list: JSON.stringify(this.list)
  174. });
  175. // this.$u.get('/warehouse/seaprice/query').then(res=>{
  176. // console.log(res)
  177. // })
  178. },
  179. textTips(text) {
  180. uni.showToast({
  181. icon: 'none',
  182. title: text,
  183. position: "center"
  184. })
  185. },
  186. deleteRecord(id) {
  187. console.log(id)
  188. if (id) {
  189. this.$u.delete('/quotation/queryseapricelog/' + id).then(res => {
  190. console.log(res)
  191. this.history()
  192. })
  193. } else {
  194. console.log(id)
  195. }
  196. },
  197. deleteAll() {
  198. let id = ''
  199. for (let item in this.historyList) {
  200. id += this.historyList[item].fId + ','
  201. }
  202. id = id.substring(0, id.length - 1);
  203. this.deleteRecord(id)
  204. }
  205. }
  206. }
  207. </script>
  208. <style>
  209. </style>