freightCalculation.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view>
  3. <view
  4. style="width: 96%;margin: 0 auto;box-shadow: 0px 0px 8px 0px rgb(165 189 251 / 40%);padding: 20rpx;border-radius: 20rpx;">
  5. <u-form :model="form" ref="uForm">
  6. <u-form-item label="业务类型" label-width="130rpx">
  7. <u-input v-model="fBilltype" @click="businesstype = !businesstype" type="select"
  8. placeholder="请输入业务类型" />
  9. </u-form-item>
  10. <u-form-item label="船公司" label-width="130rpx">
  11. <u-input v-model="fCorpid" @click="shippingcompany = !shippingcompany" type="select"
  12. placeholder="请输入船公司" />
  13. </u-form-item>
  14. <u-form-item label="航线" label-width="130rpx">
  15. <u-input v-model="fLineName" @click="fLine = !fLine" type="select" placeholder="请选择航线" />
  16. </u-form-item>
  17. <u-form-item label="订舱代理" label-width="130rpx">
  18. <u-input v-model="fBookagentName" @click="fBookagent = !fBookagent" type="select" placeholder="请选择订舱代理" />
  19. </u-form-item>
  20. <u-form-item label="箱型" label-width="130rpx">
  21. <u-input v-model="fSpecification" @click="boxtype = !boxtype" type="select" placeholder="请输入箱型" />
  22. </u-form-item>
  23. <u-form-item label="箱量" label-width="130rpx">
  24. <u-input v-model="form.fQty" placeholder="请输入箱量" type="digit" />
  25. </u-form-item>
  26. <u-form-item label="海运费" label-width="130rpx">
  27. <u-input v-model="form.shippingFee" placeholder="请输入海运费" @input="amtrmb" type="digit" />
  28. </u-form-item>
  29. <u-form-item label="汇率" label-width="130rpx">
  30. <u-input v-model="form.exrate" placeholder="请输入汇率" @input="amtrmb" type="digit" />
  31. </u-form-item>
  32. <u-form-item label="折合人民币" label-width="160rpx">
  33. <u-input v-model="form.rmb" placeholder="请输入海运费和汇率后自动计算" type="digit" disabled />
  34. </u-form-item>
  35. </u-form>
  36. </view>
  37. <view style="width: 100%;position:fixed; bottom:0;background-color: #FFFFFF;padding-left: 20px;padding-right: 20px;padding-bottom: 30rpx;">
  38. <u-button type="primary" @click="submit">立即计算</u-button>
  39. </view>
  40. <view style="width: 100%;padding-bottom: 110rpx;" v-if="datalist === true">
  41. <h2 style="text-align: center;margin-top: 20rpx;margin-bottom: 20rpx;">预测价格:{{parseInt(amt)}}元</h2>
  42. <u-table>
  43. <u-tr>
  44. <u-th>费用</u-th>
  45. <u-th>价格</u-th>
  46. <u-th>备注</u-th>
  47. </u-tr>
  48. <u-tr v-for="(item,index) in this.fleet" :key="index">
  49. <u-td style="height: 60rpx;">{{item.fFeeid?item.fFeeid:'费用名称丢失'}}</u-td>
  50. <u-td style="height: 60rpx;">{{item.fUnitprice}}</u-td>
  51. <u-td style="height: 60rpx;">{{item.remark?'item.remark':'1'}}</u-td>
  52. </u-tr>
  53. </u-table>
  54. </view>
  55. <!-- 订舱代理下拉 -->
  56. <u-action-sheet :list="fBookagentList" v-model="fBookagent" @click="fBookagentType"></u-action-sheet>
  57. <!-- 航线下拉 -->
  58. <u-action-sheet :list="fLineList" v-model="fLine" @click="fLineType"></u-action-sheet>
  59. <!-- 箱型下拉 -->
  60. <u-action-sheet :list="list" v-model="boxtype" @click="boxType"></u-action-sheet>
  61. <!-- 业务类型 -->
  62. <u-action-sheet :list="businessList" v-model="businesstype" @click="businessType"></u-action-sheet>
  63. <!-- 船公司 -->
  64. <u-action-sheet :list="shippingList" v-model="shippingcompany" @click="shippingCompany"></u-action-sheet>
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. data() {
  70. return {
  71. form: {},
  72. fSpecification: '',
  73. fBookagentName: '',
  74. fBilltype: '',
  75. fLineName: '',
  76. fCorpid: '',
  77. boxtype: false,
  78. fLine: false,
  79. fBookagent: false,
  80. businesstype: false,
  81. shippingcompany: false,
  82. datalist: false,
  83. businessList: [],
  84. shippingList: [],
  85. amt: '',
  86. fleet: [],
  87. fLineList: [],
  88. fBookagentList: [],
  89. list: [{
  90. id: 'f_specification1',
  91. text: '20GP'
  92. }, {
  93. id: 'f_specification2',
  94. text: '40GP'
  95. }, {
  96. id: 'f_specification3',
  97. text: '40HC'
  98. }, {
  99. id: 'f_specification4',
  100. text: '45HC'
  101. }, {
  102. id: 'f_specification5',
  103. text: '20RH'
  104. }, {
  105. id: 'f_specification6',
  106. text: '40RH'
  107. }],
  108. };
  109. },
  110. created() {
  111. this.$u.get('/shipping/address/list', {
  112. fTypes: 4
  113. }).then(res => {
  114. for(let item in res.rows){
  115. this.fLineList.push({
  116. id: res.rows[item].fId,
  117. text: res.rows[item].fName
  118. })
  119. }
  120. })
  121. this.$u.get('/basicdata/corps/list', {
  122. fTypeid:9
  123. }).then(res => {
  124. for(let item in res.rows){
  125. this.fBookagentList.push({
  126. id: res.rows[item].fId,
  127. text: res.rows[item].fName
  128. })
  129. }
  130. })
  131. this.$u.get('/warehouse/seaprice/appBasicInformation').then(res => {
  132. console.log(res)
  133. this.businessList = res.data.billType
  134. this.shippingList = res.data.corpList
  135. this.businessList.forEach(item => item.text = item.dictLabel)
  136. this.shippingList.forEach(item => item.text = item.fName)
  137. this.businessList.forEach(item => {
  138. if (item.dictLabel == '进口') {
  139. this.form.fBilltype = item.dictValue
  140. this.fBilltype = item.dictLabel
  141. }
  142. })
  143. })
  144. },
  145. methods: {
  146. //查询运费和汇率
  147. information() {
  148. if (this.form.fSpecification && this.form.fBilltype && this.form.fCorpid) {
  149. this.$u.get('/warehouse/seaprice/changeSelectShippingFee', this.form).then(res => {
  150. // console.log(res.data)
  151. if (res.data) {
  152. this.$set(this.form, 'shippingFee', res.data.fUnitprice)
  153. this.$set(this.form, 'exrate', res.data.fExrate)
  154. this.$set(this.form, 'rmb', res.data.rmb)
  155. }
  156. })
  157. }
  158. },
  159. //折合人民币计算
  160. amtrmb() {
  161. this.form.rmb = this.form.shippingFee * this.form.exrate
  162. },
  163. //箱型下拉赋值
  164. boxType(index) {
  165. this.form.fSpecification = this.list[index].id
  166. this.fSpecification = this.list[index].text
  167. this.information()
  168. },
  169. //航线下拉
  170. fLineType(index) {
  171. this.form.fLineid = this.fLineList[index].dictValue
  172. this.fLineName = this.fLineList[index].text
  173. },
  174. //订舱代理下拉
  175. fBookagentType(index) {
  176. this.form.fBookagentid = this.fBookagentList[index].dictValue
  177. this.fBookagentName = this.fBookagentList[index].text
  178. },
  179. //业务类型
  180. businessType(index) {
  181. this.form.fBilltype = this.businessList[index].dictValue
  182. this.fBilltype = this.businessList[index].text
  183. this.information()
  184. },
  185. //船公司
  186. shippingCompany(index) {
  187. this.form.fCorpid = this.shippingList[index].fId
  188. this.fCorpid = this.shippingList[index].text
  189. this.information()
  190. },
  191. //计算
  192. submit() {
  193. this.$u.get('/warehouse/seaprice/calculateCost', this.form).then(res => {
  194. if (res.code == 500) {
  195. uni.showToast({
  196. icon: 'none',
  197. title: res.msg,
  198. position: "bottom"
  199. })
  200. this.datalist = false
  201. } else {
  202. this.amt = res.data.amt
  203. this.fleet = res.data.fleet
  204. this.datalist = true
  205. }
  206. })
  207. }
  208. }
  209. };
  210. </script>
  211. <style scoped lang="scss">
  212. .u-form ::v-deep .u-form-item {
  213. padding: 5rpx;
  214. }
  215. </style>