editThreeSectionHandleFee.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <!-- 修改三程船装卸费4-->
  3. <div class="addWagonLoad">
  4. <PageTitle>返回</PageTitle>
  5. <div class="form-box">
  6. <!-- <dil-form :formId="271" v-model="form1" ref="from1"></dil-form> -->
  7. <el-form v-model="form">
  8. <div class="searchSelect">
  9. <span class="text">批次</span>
  10. <el-input class="input" v-model="batchName" disabled> </el-input>
  11. <el-button class="button" type="primary" @click="ondrawer(5)">浏览</el-button>
  12. </div>
  13. <div class="searchSelect">
  14. <span class="text">单价</span>
  15. <el-input class="input" v-model="form.unitPrice" disabled @change="calculate"> </el-input>
  16. <el-button class="button" type="primary" @click="ondrawer(6)">浏览</el-button>
  17. </div>
  18. <div class="preview-group">
  19. <el-form-item label="实装吨位">
  20. <el-input v-model="form.realTonnage" type="number" @change="calculate"></el-input>
  21. </el-form-item>
  22. <el-form-item label="水运费用">
  23. <el-input v-model="form.fee" type="number" disabled></el-input>
  24. </el-form-item>
  25. <el-form-item label="开票日期">
  26. <el-date-picker
  27. v-model="form.makeTime"
  28. type="datetime"
  29. placeholder="选择日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item label="上传水运单图片">
  33. <el-upload
  34. class="upload-demo"
  35. style="width: 270px"
  36. ref="upload1"
  37. accept=".pdf , .jpg, .png, .jpeg, .tif, .gif, .pcx, .tga, .exif, .fpx, .svg , .bmp"
  38. action="/api/v1/bms/uploadBmsshipOrder"
  39. :before-upload="beforeUpload"
  40. :multiple="false"
  41. list-type="picture"
  42. :show-file-list="false"
  43. :on-success="handleAvatarSuccess"
  44. :on-error="onError(1)">
  45. <el-input
  46. class="shippingCertificate"
  47. style="width: 270px; display: flex"
  48. placeholder="上传水运单图片(必填项)"
  49. v-model="form.image"
  50. disabled
  51. >
  52. </el-input>
  53. <el-button
  54. size="small"
  55. type="primary"
  56. style="
  57. width: 115px;
  58. height: 35px;
  59. margin-left: 275px;
  60. margin-top: -35px;
  61. display: flex;
  62. "
  63. @click="upCLick(1)">
  64. 点击上传附件</el-button
  65. >
  66. </el-upload>
  67. </el-form-item>
  68. </div>
  69. </el-form>
  70. </div>
  71. <!-- 模态框 -->
  72. <el-drawer
  73. :visible.sync="drawer"
  74. :direction="direction"
  75. :before-close="handleClose"
  76. size="50%"
  77. >
  78. <el-input
  79. placeholder="请输入内容"
  80. v-model="input"
  81. style="margin-top: 10px; margin-left: 20px; width: 250px"
  82. clearable
  83. >
  84. </el-input>
  85. <el-button
  86. type="primary"
  87. class="btn"
  88. @click="onclick(a)"
  89. style="margin-bottom: 15px">
  90. <i class="el-icon-search"></i>查询
  91. </el-button>
  92. <div v-show="a == 5">
  93. <dilTable
  94. v-bind.sync="batchOption"
  95. @radio-change="batchChange"
  96. ></dilTable>
  97. </div>
  98. <div v-show="a == 6">
  99. <dilTable
  100. v-bind.sync="contractPriceOption"
  101. @radio-change="priceChange"
  102. ></dilTable>
  103. </div>
  104. </el-drawer>
  105. <!-- 底部按钮 -->
  106. <div class="button-box">
  107. <el-button @click="cancel">取消</el-button>
  108. <el-button type="primary" @click="makeSure" :loading="isLoading">确定</el-button>
  109. </div>
  110. </div>
  111. </template>
  112. <script>
  113. import PageTitle from "@/components/Page/Title";
  114. import { sjTime } from "@/utils/sharedJsFile";
  115. import { getCookie } from "@/utils/util.js";
  116. import {BigNumber} from 'bignumber.js';
  117. export default {
  118. components: { PageTitle },
  119. data() {
  120. return {
  121. form: {},
  122. portId:null,
  123. ports:[],
  124. isLoading:false,
  125. drawer: false,
  126. direction: "rtl",
  127. a:0,
  128. input:null,
  129. batchId:null,
  130. purchaseOrderId:null,
  131. batchName:null,
  132. cargoPictureUrl: "",
  133. batchOption: {
  134. requestUrl: "/api/v1/uc/selectPurchaseOrderForShip?apiId=502",
  135. selectionType: "radio",
  136. map: [],
  137. },
  138. contractPriceOption: {
  139. requestUrl: "/api/v1/rms/selectbmsshipContractPriceList?apiId=500",
  140. selectionType: "radio",
  141. map: [],
  142. }
  143. };
  144. },
  145. mounted() {
  146. //this.getPorts();
  147. this.information();
  148. },
  149. methods: {
  150. information() {
  151. //编辑车皮装车作业
  152. this.axios
  153. .post(
  154. "/api/v1/bms/getBmsshipFee/" + this.$route.params.resultId
  155. )
  156. .then((res) => {
  157. res.data.data.forEach((e) => {
  158. console.log(e);
  159. this.form = e;
  160. this.batchName=e.batchName;
  161. this.batchId=e.batchId;
  162. this.purchaseOrderId=e.purchaseOrderId;
  163. });
  164. });
  165. },
  166. //右侧选中框
  167. ondrawer(num) {
  168. this.drawer = true;
  169. this.a = num;
  170. // 清空当前输入框中的数据
  171. this.input = "";
  172. },
  173. handleClose(done) {
  174. done();
  175. },
  176. onclick(a) {
  177. if(a==5){
  178. this.batchOption.requestUrl =
  179. "/api/v1/uc/selectPurchaseOrderForShip?apiId=502&index=" + this.input;
  180. }else if(a==6){
  181. this.contractPriceOption.requestUrl =
  182. "api/v1/rms/selectbmsshipContractPriceList?apiId=500&con=" + this.input;
  183. }
  184. },
  185. //修改选中
  186. batchChange(selection) {
  187. this.batchId=selection.batchId;
  188. this.purchaseOrderId=selection.purchaseOrderId;
  189. console.log("before",this.batchName);
  190. this.batchName =selection.materialName + selection.resultForeignShipName;
  191. console.log("before",this.batchName);
  192. console.log("batch",selection);
  193. },
  194. priceChange(selection){
  195. this.form.unitPriceId = selection.resultId;
  196. this.form.unitPrice = selection.unitPrice;
  197. console.log("unitPrice:",selection);
  198. this.calculate();
  199. },
  200. //计算水运费
  201. calculate(){
  202. console.log("能否计算水运费:",this.form.realTonnage && this.form.unitPrice);
  203. if(this.form.realTonnage && this.form.unitPrice){
  204. let fee = new BigNumber(this.form.realTonnage);
  205. this.$set(this.form,'fee',fee.multipliedBy(this.form.unitPrice).toNumber())
  206. console.log(this.form.fee);
  207. }
  208. },
  209. makeSure() {
  210. this.isLoading=true;
  211. let map={
  212. resultId:this.form.resultId,
  213. batchId:this.batchId,
  214. purchaseOrderId:this.purchaseOrderId,
  215. unitPrice:this.form.unitPrice,
  216. unitPriceId:this.form.unitPriceId,
  217. realTonnage:this.form.realTonnage,
  218. fee:this.form.fee,
  219. makeTime:sjTime(this.form.makeTime),
  220. image:this.form.image,
  221. feeType:4,
  222. userId:getCookie("userId")
  223. }
  224. console.log(map);
  225. if(
  226. map.unitPrice==null ||
  227. map.realTonnage==null ||
  228. map.fee==null ||
  229. map.makeTime==null ||
  230. map.image==null || map.image==''
  231. ){
  232. this.$message.error("存在空值!");
  233. this.isLoading=false;
  234. }else{
  235. map.startTime = sjTime(this.form.startTime);
  236. map.endTime = sjTime(this.form.endTime);
  237. this.axios.post("/api/v1/bms/updatePortHandlingFee",map).then(res => {
  238. if (res.data.code == 0) {
  239. this.$message({
  240. type: "success",
  241. message: "修改成功!"
  242. });
  243. this.cancel();
  244. } else {
  245. this.$message.error(res.data.data);
  246. }
  247. }).then(()=>{
  248. this.isLoading=false;
  249. });
  250. }
  251. },
  252. // 取消
  253. cancel() {
  254. this.$router.go(-1);
  255. },
  256. //查询港口id
  257. getPorts(){
  258. this.axios.post("/api/v1/rms/getPortName?index=").then(res => {
  259. if (res.data.code == 200) {
  260. this.ports=res.data.data;
  261. console.log(this.ports);
  262. } else {
  263. this.$message.error(res.data.data);
  264. }
  265. });
  266. },
  267. beforeUpload(file) {
  268. this.upBool = true;
  269. const isLt2M = file.size < 1024 * 1024 * 0.5;
  270. if (!isLt2M) {
  271. this.$message.error("上传文件大小不能超过500kb!");
  272. } else {
  273. let size = file.size / 1024;
  274. let _URL = window.URL || window.webkitURL;
  275. let img = new Image();
  276. img.src = _URL.createObjectURL(file);
  277. }
  278. return isLt2M;
  279. },
  280. onError(err) {
  281. if (this.upBool) {
  282. if (this.num == 1) {
  283. this.form.image = null;
  284. this.$message.error("上传失败");
  285. }
  286. }
  287. },
  288. handleAvatarSuccess(res, file) {
  289. if (res.code) {
  290. this.upBool = false;
  291. if (this.num == 1) {
  292. this.form.image = res.data;
  293. }
  294. this.$message.success("上传成功");
  295. }
  296. },
  297. upCLick(val) {
  298. this.num = val;
  299. },
  300. }
  301. };
  302. </script>
  303. <style lang="scss">
  304. .searchSelect {
  305. display: flex;
  306. align-items: center;
  307. justify-content: center;
  308. margin: 5px;
  309. .text {
  310. width: 40px;
  311. }
  312. .input {
  313. width: 200px;
  314. }
  315. .button {
  316. margin-left: 6px;
  317. }
  318. }
  319. .button-box {
  320. display: flex;
  321. justify-content: center;
  322. margin: 20px;
  323. .el-button {
  324. width: 80px;
  325. margin: 10px;
  326. }
  327. }
  328. .form-box {
  329. display: flex;
  330. justify-content: center;
  331. .el-form-item {
  332. display: flex;
  333. justify-content: center;
  334. .el-form-item__label {
  335. display: flex;
  336. align-items: center;
  337. }
  338. .el-form-item__content {
  339. .el-input {
  340. .el-input__inner {
  341. width: 250px;
  342. }
  343. }
  344. }
  345. }
  346. }
  347. </style>