freightCalculation.vue 7.9 KB

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