freightCalculation.vue 7.7 KB

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