freightCalculation.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. onLoad(option) {
  111. if(JSON.parse(option.form).fCorpName) this.fCorpid = JSON.parse(option.form).fCorpName
  112. if(JSON.parse(option.form).fCorpid) this.form.fCorpid = JSON.parse(option.form).fCorpid
  113. this.$u.get('/warehouse/seaprice/appBasicInformation').then(res => {
  114. this.businessList = res.data.billType
  115. this.shippingList = res.data.corpList
  116. this.businessList.forEach(item => item.text = item.dictLabel)
  117. this.shippingList.forEach(item => item.text = item.fName)
  118. this.businessList.forEach(item => {
  119. if (item.dictLabel == JSON.parse(option.form).fBilltype) {
  120. this.form.fBilltype = item.dictValue
  121. this.fBilltype = item.dictLabel
  122. }
  123. })
  124. })
  125. // this.submit()
  126. },
  127. created() {
  128. this.$u.get('/shipping/address/list', {
  129. fTypes: 4
  130. }).then(res => {
  131. for(let item in res.rows){
  132. this.fLineList.push({
  133. id: res.rows[item].fId,
  134. text: res.rows[item].fName
  135. })
  136. }
  137. })
  138. this.$u.get('/basicdata/corps/list', {
  139. fTypeid:9
  140. }).then(res => {
  141. for(let item in res.rows){
  142. this.fBookagentList.push({
  143. id: res.rows[item].fId,
  144. text: res.rows[item].fName
  145. })
  146. }
  147. })
  148. },
  149. methods: {
  150. //查询运费和汇率
  151. information() {
  152. if (this.form.fSpecification && this.form.fBilltype && this.form.fCorpid) {
  153. this.$u.get('/warehouse/seaprice/changeSelectShippingFee', this.form).then(res => {
  154. // console.log(res.data)
  155. if (res.data) {
  156. this.$set(this.form, 'shippingFee', res.data.fUnitprice)
  157. this.$set(this.form, 'exrate', res.data.fExrate)
  158. this.$set(this.form, 'rmb', res.data.rmb)
  159. }
  160. })
  161. }
  162. },
  163. //折合人民币计算
  164. amtrmb() {
  165. this.form.rmb = this.form.shippingFee * this.form.exrate
  166. },
  167. //箱型下拉赋值
  168. boxType(index) {
  169. this.form.fSpecification = this.list[index].id
  170. this.fSpecification = this.list[index].text
  171. this.information()
  172. },
  173. //航线下拉
  174. fLineType(index) {
  175. this.form.fLineid = this.fLineList[index].dictValue
  176. this.fLineName = this.fLineList[index].text
  177. },
  178. //订舱代理下拉
  179. fBookagentType(index) {
  180. this.form.fBookagentid = this.fBookagentList[index].dictValue
  181. this.fBookagentName = this.fBookagentList[index].text
  182. },
  183. //业务类型
  184. businessType(index) {
  185. this.form.fBilltype = this.businessList[index].dictValue
  186. this.fBilltype = this.businessList[index].text
  187. this.information()
  188. },
  189. //船公司
  190. shippingCompany(index) {
  191. this.form.fCorpid = this.shippingList[index].fId
  192. this.fCorpid = this.shippingList[index].text
  193. this.information()
  194. },
  195. //计算
  196. submit() {
  197. this.$u.get('/warehouse/seaprice/calculateCost', this.form).then(res => {
  198. if (res.code == 500) {
  199. uni.showToast({
  200. icon: 'none',
  201. title: res.msg,
  202. position: "bottom"
  203. })
  204. this.datalist = false
  205. } else {
  206. this.amt = res.data.amt
  207. this.fleet = res.data.fleet
  208. this.datalist = true
  209. }
  210. })
  211. }
  212. }
  213. };
  214. </script>
  215. <style scoped lang="scss">
  216. .u-form ::v-deep .u-form-item {
  217. padding: 5rpx;
  218. }
  219. </style>