improvedWrehousingDetail.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. <template>
  2. <view class="warp">
  3. <view class="top">
  4. <view class="top-left">{{warehouseName}}</view>
  5. <view>{{binNumber}}仓位</view>
  6. </view>
  7. <view class="content">
  8. <view class="row">
  9. <view class="left">合同编号</view>
  10. <view @click='slectcontractNo'>{{detailData.contractNo}}</view>
  11. </view>
  12. <view class="row">
  13. <view class="left">货名</view>
  14. <view class="right">{{detailData.goodsName}}</view>
  15. </view>
  16. <view class="row">
  17. <view class="left">类型</view>
  18. <view @click='show1=true'>{{detailData.type}}</view>
  19. <u-picker :range="typeList" range-key="type" @confirm='typePicker($event)' v-model="show1"
  20. mode="selector">
  21. </u-picker>
  22. </view>
  23. <view class="row row-bottom">
  24. <view class="left">毛重(吨)</view>
  25. <input @input='calculate' v-model='detailData.grossWeight' class="right-bottom"
  26. placeholder="输入毛重"></input>
  27. </view>
  28. <view class="row row-bottom">
  29. <view class="left">皮重(吨)</view>
  30. <input @input='calculate' v-model='detailData.tare' class="right-bottom" placeholder="输入皮重"></input>
  31. </view>
  32. <view class="row row-bottom">
  33. <view class="left">扣重(吨)</view>
  34. <input @input='calculate' v-model='detailData.deductionWeight' class="right-bottom"
  35. placeholder="输入扣重"></input>
  36. </view>
  37. <view class="row row-bottom">
  38. <view class="left">净重(吨)</view>
  39. <input @input='' v-model='netWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  40. :disabled="true"></input>
  41. </view>
  42. <view class="row row-bottom">
  43. <view class="left">扣款(元/吨)</view>
  44. <input @input='' v-model='detailData.deductionAmount' class="right-bottom" placeholder="输入扣款"></input>
  45. </view>
  46. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  47. <view class="left">扣重比</view>
  48. <input @input='' v-model='detailData.buckleWeightRatio' class="right-bottom" placeholder="输入扣重比"
  49. @input="pureWeightCount"></input>
  50. </view>
  51. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  52. <view class="left">干粮水分(%)</view>
  53. <input @input='' v-model='detailData.solidGrainWater' class="right-bottom" placeholder="输入干粮水分占比"
  54. @input="pureWeightCount"></input>
  55. </view>
  56. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  57. <view class="left">潮粮水分(%)</view>
  58. <input @input='' v-model='detailData.tidalGrainWater' class="right-bottom" placeholder="输入潮粮水分占比"
  59. @input="pureWeightCount"></input>
  60. </view>
  61. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  62. <view class="left">纯重(吨)</view>
  63. <input @input='calculate' v-model='detailData.pureWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  64. :disabled="true"></input>
  65. </view>
  66. <view class="row">
  67. <view class="left">品级</view>
  68. <view @click='show3=true'>{{detailData.grade}}</view>
  69. <u-picker :range="pjList" range-key="grade" @confirm='handlerPicker($event)' v-model="show3"
  70. mode="selector">
  71. </u-picker>
  72. </view>
  73. <view class="row">
  74. <view class="left">经办人</view>
  75. <view @click='show6=true'>{{detailData.agent}}</view>
  76. <u-picker :range="handlerList" range-key="staffName" @confirm='handlerPicker($event)' v-model="show6"
  77. mode="selector">
  78. </u-picker>
  79. </view>
  80. <view class="row">
  81. <view class="left">入库日期</view>
  82. <view @click='show4=true'>{{detailData.inOutDate}}</view>
  83. <u-picker v-model="show4" mode="time" @confirm='dateChange($event)' :params="params">
  84. </u-picker>
  85. </view>
  86. <view class="row">
  87. <view class="left">入库类型</view>
  88. <view @click='show5=true'>{{detailData.inOutType}}</view>
  89. <u-picker :range="warehousingTypeList" range-key="constValue" @confirm='warehousingTypePicker($event)'
  90. v-model="show5" mode="selector">
  91. </u-picker>
  92. </view>
  93. <view class="row row-bottom">
  94. <view class="left">车牌号</view>
  95. <input v-if="!isPC" @input='' v-model='detailData.carNo' class="right-bottom"
  96. placeholder="请输入车牌号"></input>
  97. <view @click='slectCarNo' v-if="isPC">{{detailData.carNo}}</view>
  98. </view>
  99. <view class="row row-bottom has-btn">
  100. <view class="left">成本(元/吨)</view>
  101. <input v-if="detailData.inOutType=='采购入库'" v-model='detailData.cost' class="right-bottom"
  102. placeholder="自动获取" :disabled="isEditCB"></input>
  103. <u-button class="edit-btn" hover-class="none" @click="editCB">编辑</u-button>
  104. </view>
  105. <view class="row row-bottom has-btn">
  106. <view class="left">运费(元/吨)</view>
  107. <input @input='' v-model='detailData.freight' :disabled="isEditYF" class="right-bottom"
  108. placeholder="自动获取"></input>
  109. <u-button class="edit-btn" hover-class="none" @click="editYF">编辑</u-button>
  110. </view>
  111. </view>
  112. <view class="content2">
  113. <view class="left">上传磅单</view>
  114. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1" :file-list="imgUrl"
  115. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  116. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  117. </view>
  118. <view class="content1">
  119. <view class="title">
  120. 质检数据(选填)
  121. </view>
  122. <view class="row row-bottom">
  123. <view class="left">质检员</view>
  124. <input @input='' v-model='detailData.warehouseInOutDetail.qualityInspector' class="right-bottom"
  125. placeholder="输入质检员姓名"></input>
  126. </view>
  127. <view class="row row-bottom">
  128. <view class="left">水分(%)</view>
  129. <input @input='' v-model='detailData.warehouseInOutDetail.waterContent' class="right-bottom"
  130. placeholder="输入水分占比"></input>
  131. </view>
  132. <view class="row row-bottom" >
  133. <view class="left">容重(克/升)</view>
  134. <input v-model='detailData.warehouseInOutDetail.bulkDensity' class="right-bottom"
  135. placeholder="输入容重"></input>
  136. </view>
  137. <view class="row row-bottom">
  138. <view class="left">热损伤(%)</view>
  139. <input @input='' v-model='detailData.warehouseInOutDetail.jiaorenli' class="right-bottom"
  140. placeholder="输入热损伤占比"></input>
  141. </view>
  142. <view class="row row-bottom">
  143. <view class="left">杂质(%)</view>
  144. <input @input='' v-model='detailData.warehouseInOutDetail.impurity' class="right-bottom"
  145. placeholder="输入杂质占比"></input>
  146. </view>
  147. <view class="row row-bottom">
  148. <view class="left">霉变粒(%)</view>
  149. <input @input='' v-model='detailData.warehouseInOutDetail.mildewGrain' class="right-bottom"
  150. placeholder="输入霉变粒占比"></input>
  151. </view>
  152. <view class="row row-bottom">
  153. <view class="left">不完善粒(%)</view>
  154. <input @input='' v-model='detailData.warehouseInOutDetail.imperfectGrain' class="right-bottom"
  155. placeholder="输入不完善粒占比"></input>
  156. </view>
  157. </view>
  158. <u-toast ref="uToast" />
  159. <view class="bottom-btn">
  160. <u-button type="primary" class="submit" hover-class="none" @click="submit(1)">暂存</u-button>
  161. <u-button type="primary" class="submit" hover-class="none" @click="submit(2)">提交</u-button>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. import {
  167. mapState
  168. } from 'vuex';
  169. import upload from '@/components/upload.vue';
  170. import helper from '@/common/helper.js';
  171. export default {
  172. components: {
  173. upload
  174. },
  175. data() {
  176. return {
  177. show: false,
  178. show1: false,
  179. show2: false,
  180. show3: false,
  181. show4: false,
  182. show5: false,
  183. show6: false,
  184. isPC: true,
  185. params: {
  186. year: true,
  187. month: true,
  188. day: true,
  189. },
  190. isEditCB: 'false',
  191. isEditYF: 'false',
  192. warehouseName: '',
  193. binNumber: '',
  194. typeList: [{
  195. type: "干粮"
  196. },
  197. {
  198. type: "潮粮"
  199. }
  200. ],
  201. pjList: [{
  202. grade: "一等品"
  203. },
  204. {
  205. grade: "二等品"
  206. },
  207. {
  208. grade: "三等品"
  209. },
  210. {
  211. grade: "等外"
  212. }
  213. ],
  214. handlerList: [],
  215. warehousingTypeList: [],
  216. action: this.$uploadUrl,
  217. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  218. btnLoading: false, //防止重复点击
  219. isAdd: true,
  220. netWeight: 0,
  221. inOutDate1: "",
  222. detailData: {
  223. contractNo: "请选择合同编号",
  224. carNo: '',
  225. type: "干粮",
  226. goodsName: "",
  227. inOutDate: '请输入库日期',
  228. grade: "一等品",
  229. agent: '请选择经办人',
  230. inOutType: '请选择入库类型',
  231. deductionWeight: 0,
  232. grossWeight: 0,
  233. tare: 0,
  234. deductionAmount: 0,
  235. netWeight: 0,
  236. warehouseInOutDetail: {}
  237. },
  238. imgUrl: []
  239. }
  240. },
  241. onLoad(options) {
  242. this.detailData = JSON.parse(options.data)
  243. this.netWeight = this.detailData.netWeight
  244. this.binNumber = this.detailData.binNumber
  245. this.warehouseName = this.detailData.warehouseName
  246. this.compId = helper.erpWarehouse.compId
  247. if(this.detailData.addressUrl){
  248. this.imgUrl.push({
  249. url: this.detailData.addressUrl.split(",")[0]
  250. })
  251. }
  252. },
  253. computed: {
  254. ...mapState(['hasLogin', 'userInfo']),
  255. },
  256. onShow() {
  257. if (this.detailData.inOutType == '采购入库'&&this.detailData.status!='已暂存') {
  258. this.detailData.freight = 0
  259. }
  260. if (!this.detailData.tranCarInfoList) this.detailData.tranCarInfoList = []
  261. if (!this.detailData.contractNo) {
  262. this.detailData.contractNo = '请选择合同编号'
  263. } else {
  264. if (this.detailData.tranCarInfoList.length == 0) {
  265. this.isPC = false
  266. }
  267. }
  268. if (!this.detailData.goodsName) {
  269. this.detailData.goodsName = '货名'
  270. }
  271. let _data = uni.getStorageSync('erpContractNo')==''?{}:uni.getStorageSync('erpContractNo')
  272. this.detailData.contractNo = _data.contractNo
  273. if (!_data.tranCarInfoList){
  274. this.isPC = false
  275. this.detailData.carNo = ""
  276. _data.tranCarInfoList = []
  277. } else{
  278. this.isPC = true
  279. if(uni.getStorageSync('ContractNoCar')){
  280. this.detailData.carNo = uni.getStorageSync('ContractNoCar')
  281. this.$api.doRequest('get', '/warehouseBaseInfo/selectCost', {
  282. contractNo: this.detailData.contractNo,
  283. carNo:this.detailData.carNo
  284. }).then(res => {
  285. if (res.data.code == 200) {
  286. this.detailData.cost = res.data.data
  287. }
  288. })
  289. }else{
  290. this.detailData.carNo = _data.tranCarInfoList[0].carNo
  291. }
  292. }
  293. if(this.detailData.carNo){
  294. for(let i = 0 ; i < uni.getStorageSync('erpContractNo').tranCarInfoList.length ;i++){
  295. if(uni.getStorageSync('erpContractNo').tranCarInfoList[i].carNo == this.detailData.carNo)
  296. this.detailData.tranCarNo = uni.getStorageSync('erpContractNo').tranCarInfoList[i].tranCarNo
  297. }
  298. }
  299. // 获取入库类型
  300. this.getrkType()
  301. //获取经办人
  302. this.getPerson()
  303. },
  304. watch: {
  305. netWeight: function(v) {
  306. this.pureWeightCount()
  307. },
  308. },
  309. methods: {
  310. //计算纯重
  311. pureWeightCount() {
  312. if (this.netWeight && this.detailData.buckleWeightRatio && this.detailData.solidGrainWater && this
  313. .detailData.tidalGrainWater) {
  314. // 纯重=净重x[100-(潮粮水分-干粮水分)x扣重比]/100
  315. this.detailData.pureWeight = 100 - (this.detailData.tidalGrainWater - this.detailData
  316. .solidGrainWater) * this.netWeight * this.detailData.buckleWeightRatio / 100
  317. this.detailData.pureWeight = this.detailData.pureWeight.toFixed(3)
  318. }
  319. },
  320. getPerson() {
  321. this.$api.doRequest('get', '/staff/query/getStaffListByCompId', {
  322. compId: this.compId
  323. }).then(res => {
  324. this.handlerList = res.data.data
  325. })
  326. },
  327. getrkType() {
  328. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  329. constId: 'CON5'
  330. }).then(res => {
  331. this.warehousingTypeList = res.data.data
  332. })
  333. },
  334. contractNopicker(e) {},
  335. typePicker(e) {
  336. console.log(e)
  337. this.detailData.type = this.typeList[e].type
  338. },
  339. pjPicker(e) {
  340. console.log(e)
  341. },
  342. handlerPicker(e) {
  343. console.log(e)
  344. this.detailData.agent = this.handlerList[e].staffName
  345. },
  346. dateChange(e) {
  347. console.log(e)
  348. this.detailData.inOutDate = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute + ":" + e.second
  349. },
  350. warehousingTypePicker(e) {
  351. this.detailData.inOutTypeKey = e[0]+1
  352. this.detailData.inOutType = this.warehousingTypeList[e].constValue
  353. let _data = uni.getStorageSync('erpContractNo')==''?{}:uni.getStorageSync('erpContractNo')
  354. if (this.detailData.inOutType == '采购入库') {
  355. this.detailData.freight = 0
  356. }else{this.detailData.freight = uni.getStorageSync('CarFreight')}
  357. },
  358. filterFileType(index, lists) {
  359. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  360. lists.splice(index, 1);
  361. // 当前文件不支持
  362. uni.showModal({
  363. title: '暂不支持当前图片类型',
  364. showCancel: false
  365. });
  366. } else {
  367. this.isAdd = false;
  368. }
  369. },
  370. calculate() {
  371. this.netWeight = this.detailData.grossWeight - this.detailData.tare - this.detailData.deductionWeight
  372. },
  373. getImgUrl(res) {
  374. this.detailData.addressUrl = res
  375. console.log(res)
  376. console.log('------------res-----------')
  377. },
  378. onError(error) {
  379. alert(error)
  380. console.log('------------error-----------')
  381. console.log(error)
  382. },
  383. contractNopicker(e) {
  384. // this.detailData.goodsName=this.contractNoList[e[0]].goodsName
  385. // this.detailData.contractNo=this.contractNoList[e[0]].contractNo
  386. },
  387. binNumberpicker(e) {
  388. this.detailData.binNumber = this.positionList[e[0]].binNumber
  389. },
  390. getWeighingManagement() {
  391. this.$api.doRequest('get', '/weighingManagement/getWeighingManagement', {
  392. id: this.id
  393. }).then(res => {
  394. if (res.data.code == 200) {
  395. console.log(res)
  396. this.detailData = res.data.data
  397. }
  398. })
  399. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  400. id: this.cangId
  401. }).then(res => {
  402. if (res.data.code == 200) {
  403. this.positionList = res.data.data.warehousePositionInfoList
  404. }
  405. })
  406. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  407. compId: '',
  408. flag: 5
  409. }).then(res => {
  410. if (res.data.code == 200) {
  411. this.contractNoList = res.data.data
  412. }
  413. })
  414. },
  415. onProgress(e) {
  416. console.log(e)
  417. },
  418. onRemove(index) {},
  419. editCB() {
  420. this.isEditCB = false
  421. },
  422. editYF() {
  423. this.isEditYF = false
  424. },
  425. submit(num) {
  426. if (!this.detailData.contractNo) {
  427. this.$api.msg('合同编号不能为空')
  428. return
  429. }
  430. if (!this.detailData.goodsName) {
  431. this.$api.msg('货名不能为空')
  432. return
  433. }
  434. if (!this.detailData.grossWeight) {
  435. this.$api.msg('毛重不能为空')
  436. return
  437. }
  438. if (isNaN(this.detailData.grossWeight) ||
  439. (String(this.detailData.grossWeight).indexOf('.') != -1 &&
  440. String(this.detailData.grossWeight).length -
  441. (String(this.detailData.grossWeight).indexOf('.') + 1) >
  442. 1) ||
  443. this.detailData.grossWeight < 1 ||
  444. this.detailData.grossWeight > 100000
  445. ) {
  446. this.$api.msg('毛重输入错误!')
  447. return
  448. }
  449. if (!this.detailData.tare) {
  450. this.$api.msg('皮重不能为空')
  451. return
  452. }
  453. if (isNaN(this.detailData.tare) ||
  454. (String(this.detailData.tare).indexOf('.') != -1 &&
  455. String(this.detailData.tare).length -
  456. (String(this.detailData.tare).indexOf('.') + 1) >
  457. 3) ||
  458. this.detailData.tare < 0 ||
  459. this.detailData.tare > 10
  460. ) {
  461. this.$api.msg('皮重输入错误!')
  462. return
  463. }
  464. if (!this.detailData.deductionWeight) {
  465. this.$api.msg('扣重不能为空')
  466. return
  467. }
  468. if (isNaN(this.detailData.deductionWeight) ||
  469. (String(this.detailData.deductionWeight).indexOf('.') != -1 &&
  470. String(this.detailData.deductionWeight).length -
  471. (String(this.detailData.deductionWeight).indexOf('.') + 1) >
  472. 1) ||
  473. this.detailData.deductionWeight < 1 ||
  474. this.detailData.deductionWeight > 100000
  475. ) {
  476. this.$api.msg('扣重输入错误!')
  477. return
  478. }
  479. if (this.detailData.tare > this.detailData.grossWeight) {
  480. this.$api.msg('皮重不能大于毛重')
  481. return
  482. }
  483. if (this.netWeight <= 0) {
  484. this.$api.msg('净重不能小于等于0')
  485. return
  486. }
  487. if (this.detailData.type == "潮粮") {
  488. if (!this.detailData.buckleWeightRatio) {
  489. this.$api.msg('扣重比不能为空')
  490. return
  491. }
  492. if (isNaN(this.detailData.buckleWeightRatio) ||
  493. (String(this.detailData.buckleWeightRatio).indexOf('.') != -1 &&
  494. String(this.detailData.buckleWeightRatio).length -
  495. (String(this.detailData.buckleWeightRatio).indexOf('.') + 1) >
  496. 2) ||
  497. this.detailData.buckleWeightRatio < 0 ||
  498. this.detailData.buckleWeightRatio > 2
  499. ) {
  500. this.$api.msg('扣重比输入错误!')
  501. return
  502. }
  503. if (!this.detailData.solidGrainWater) {
  504. this.$api.msg('干粮水分不能为空')
  505. return
  506. }
  507. if (isNaN(this.detailData.solidGrainWater) ||
  508. (String(this.detailData.solidGrainWater).indexOf('.') != -1 &&
  509. String(this.detailData.solidGrainWater).length -
  510. (String(this.detailData.solidGrainWater).indexOf('.') + 1) >
  511. 1) ||
  512. this.detailData.solidGrainWater < 1 ||
  513. this.detailData.solidGrainWater > 40
  514. ) {
  515. this.$api.msg('干粮水分输入错误!')
  516. return
  517. }
  518. if (!this.detailData.tidalGrainWater) {
  519. this.$api.msg('潮粮水分不能为空')
  520. return
  521. }
  522. if (isNaN(this.detailData.deductionAmount) ||
  523. (String(this.detailData.deductionAmount).indexOf('.') != -1 &&
  524. String(this.detailData.deductionAmount).length -
  525. (String(this.detailData.deductionAmount).indexOf('.') + 1) >
  526. 2) ||
  527. this.detailData.deductionAmount < 1 ||
  528. this.detailData.deductionAmount > 10000
  529. ) {
  530. this.$api.msg('扣款输入错误!')
  531. return
  532. }
  533. if (!this.detailData.deductionAmount) {
  534. this.$api.msg('扣款不能为空')
  535. return
  536. }
  537. if (isNaN(this.detailData.tidalGrainWater) ||
  538. (String(this.detailData.tidalGrainWater).indexOf('.') != -1 &&
  539. String(this.detailData.tidalGrainWater).length -
  540. (String(this.detailData.tidalGrainWater).indexOf('.') + 1) >
  541. 1) ||
  542. this.detailData.tidalGrainWater < 1 ||
  543. this.detailData.tidalGrainWater > 40
  544. ) {
  545. this.$api.msg('潮粮水分输入错误!')
  546. return
  547. }
  548. if (this.detailData.tidalGrainWater < this.detailData.solidGrainWater) {
  549. this.$api.msg('潮粮水分输入错误!')
  550. return
  551. }
  552. if (!this.detailData.pureWeight) {
  553. this.$api.msg('纯重不能为空')
  554. return
  555. }
  556. }
  557. if (this.detailData.grade == "请输入品级") {
  558. this.$api.msg('品级不能为空')
  559. return
  560. }
  561. if (this.detailData.agent == "请选择经办人") {
  562. this.$api.msg('经办人不能为空')
  563. return
  564. }
  565. if (this.detailData.inOutDate == "请选择入库日期") {
  566. this.$api.msg('入库日期不能为空')
  567. return
  568. }
  569. if (this.detailData.inOutType == "请选择入库类型") {
  570. this.$api.msg('入库类型不能为空')
  571. return
  572. }
  573. if (!this.detailData.carNo) {
  574. this.$api.msg('车牌号不能为空')
  575. return
  576. }
  577. if (this.detailData.carNo.length != 7) {
  578. this.$api.msg('车牌号输入有误!')
  579. return
  580. }
  581. if (!this.detailData.addressUrl) {
  582. this.$api.msg('请上传磅单')
  583. return
  584. }
  585. if (!this.detailData.cost) {
  586. this.$api.msg('未获取到成本,请编辑后提交')
  587. return
  588. }
  589. if (String(this.detailData.cost).indexOf('.') != -1 && String(this.detailData
  590. .cost).length - (String(
  591. this.detailData.cost).indexOf('.') + 1) > 2) {
  592. this.$api.msg('成本输入错误')
  593. return
  594. }
  595. if (this.detailData.cost < 0 || this.detailData.cost > 20000) {
  596. this.$api.msg('成本输入错误')
  597. return
  598. }
  599. if (!this.detailData.freight) {
  600. this.$api.msg('运费不能为空')
  601. return
  602. }
  603. if (this.detailData.warehouseInOutDetail.qualityInspector) {
  604. if (this.detailData.warehouseInOutDetail.qualityInspector < 2 || this.detailData
  605. .warehouseInOutDetail
  606. .qualityInspector > 10) {
  607. this.$api.msg('质检员姓名需要2-10个字')
  608. return
  609. }
  610. }
  611. if (this.detailData.warehouseInOutDetail.waterContent) {
  612. if (this.detailData.type == "潮粮" && this.detailData.warehouseInOutDetail.waterContent != this
  613. .detailData.tidalGrainWater) {
  614. this.$api.msg('水分占比与潮粮水分不一致')
  615. return
  616. }
  617. if (this.detailData.type == "干粮") {
  618. if (this.detailData.warehouseInOutDetail.waterContent < 0 || this.detailData
  619. .warehouseInOutDetail
  620. .waterContent > 40) {
  621. this.$api.msg('水分占比输入错误')
  622. return
  623. }
  624. }
  625. if (String(this.detailData.warehouseInOutDetail.waterContent).indexOf('.') != -1 && String(this
  626. .detailData.warehouseInOutDetail.waterContent).length - (String(
  627. this.detailData.warehouseInOutDetail.waterContent).indexOf('.') + 1) > 1) {
  628. this.$api.msg('水分占比输入错误')
  629. return
  630. }
  631. }
  632. if (this.detailData.warehouseInOutDetail.bulkDensity) {
  633. if (this.detailData.warehouseInOutDetail.bulkDensity < 500 || this.detailData.warehouseInOutDetail
  634. .bulkDensity > 1000) {
  635. this.$api.msg('容重输入错误')
  636. return
  637. }
  638. if (String(this.detailData.warehouseInOutDetail.bulkDensity).indexOf('.') != -1 && String(this
  639. .detailData.warehouseInOutDetail.bulkDensity).length - (
  640. String(this.detailData.warehouseInOutDetail.bulkDensity).indexOf('.') + 1) > 0) {
  641. this.$api.msg('容重输入错误')
  642. return
  643. }
  644. }
  645. if (this.detailData.warehouseInOutDetail.jiaorenli) {
  646. if (this.detailData.warehouseInOutDetail.jiaorenli < 0 || this.detailData.warehouseInOutDetail
  647. .jiaorenli > 40) {
  648. this.$api.msg('热损伤占比输入错误')
  649. return
  650. }
  651. if (String(this.detailData.warehouseInOutDetail.jiaorenli).indexOf('.') != -1 && String(this
  652. .detailData
  653. .warehouseInOutDetail.jiaorenli).length - (String(
  654. this.detailData.warehouseInOutDetail.jiaorenli).indexOf('.') + 1) > 1) {
  655. this.$api.msg('热损伤占比输入错误')
  656. return
  657. }
  658. }
  659. if (this.detailData.warehouseInOutDetail.impurity) {
  660. if (this.detailData.warehouseInOutDetail.impurity < 0 || this.detailData.warehouseInOutDetail
  661. .impurity > 40) {
  662. this.$api.msg('杂质占比输入错误')
  663. return
  664. }
  665. if (String(this.detailData.warehouseInOutDetail.impurity).indexOf('.') != -1 && String(this
  666. .detailData
  667. .warehouseInOutDetail.impurity).length - (String(
  668. this.detailData.warehouseInOutDetail.impurity).indexOf('.') + 1) > 1) {
  669. this.$api.msg('杂质占比输入错误')
  670. return
  671. }
  672. }
  673. if (this.detailData.warehouseInOutDetail.mildewGrain) {
  674. if (this.detailData.warehouseInOutDetail.mildewGrain < 0 || this.detailData.warehouseInOutDetail
  675. .mildewGrain > 40) {
  676. this.$api.msg('霉变粒占比输入错误')
  677. return
  678. }
  679. if (String(this.detailData.warehouseInOutDetail.mildewGrain).indexOf('.') != -1 && String(this
  680. .detailData
  681. .warehouseInOutDetail.mildewGrain).length - (String(
  682. this.detailData.warehouseInOutDetail.mildewGrain).indexOf('.') + 1) > 1) {
  683. this.$api.msg('霉变粒占比输入错误')
  684. return
  685. }
  686. }
  687. if (this.detailData.warehouseInOutDetail.imperfectGrain) {
  688. if (this.detailData.warehouseInOutDetail.imperfectGrain < 0 || this.detailData.warehouseInOutDetail
  689. .imperfectGrain > 40) {
  690. this.$api.msg('不完善粒占比输入错误')
  691. return
  692. }
  693. if (String(this.detailData.warehouseInOutDetail.imperfectGrain).indexOf('.') != -1 && String(this
  694. .detailData
  695. .warehouseInOutDetail.imperfectGrain).length - (String(
  696. this.detailData.warehouseInOutDetail.imperfectGrain).indexOf('.') + 1) > 1) {
  697. this.$api.msg('不完善粒占比输入错误')
  698. return
  699. }
  700. }
  701. this.detailData.baseId = helper.erpWarehouse.warehouseId
  702. this.detailData.warehouseName = helper.erpWarehouse.warehouseName
  703. this.detailData.positionId = helper.erpWarehouse.positionId
  704. this.detailData.binNumber = this.binNumber
  705. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  706. this.detailData.compId = helper.erpWarehouse.compId
  707. this.detailData.netWeight = this.netWeight
  708. this.detailData.backOffice = this.userInfo.userName
  709. this.detailData.backOfficeId = this.userInfo.id
  710. this.detailData.inOutFlag = 2
  711. this.detailData.taskType = "入库任务"
  712. this.detailData.pcFlag = 0
  713. let title = ""
  714. if (num == 1) {
  715. this.detailData.statusFlag = 1
  716. title = "暂存成功"
  717. } else if (num == 2) {
  718. this.detailData.statusFlag = 3
  719. title = "提交成功"
  720. }
  721. let that = this
  722. uni.showModal({
  723. content: "确定提交入库信息?",
  724. success(res) {
  725. if (res.confirm) {
  726. that.$api.doRequest('post', '/warehouseInOutInfo/InOutWarehouse',
  727. that.detailData).then(res => {
  728. if (res.data.code == 200) {
  729. that.$api.msg(title)
  730. setTimeout(() => {
  731. uni.navigateBack()
  732. }, 1000)
  733. }else{
  734. that.$api.msg(res.data.message)
  735. }
  736. })
  737. }
  738. }
  739. })
  740. },
  741. slectcontractNo() {
  742. uni.navigateTo({
  743. url: '/pages/erp/warehousing/selectContractNo?compId=' + this.compId
  744. })
  745. },
  746. slectCarNo() {
  747. uni.navigateTo({
  748. url: '/pages/erp/warehousing/selectCarNo'
  749. })
  750. },
  751. }
  752. }
  753. </script>
  754. <style scoped lang="scss">
  755. uni-page-body {
  756. overflow: hidden;
  757. }
  758. .warp {
  759. margin: 10rpx;
  760. padding: 20rpx 20rpx 140rpx 20rpx;
  761. .top {
  762. display: flex;
  763. margin-bottom: 20rpx;
  764. border-radius: 20rpx;
  765. background: white;
  766. padding: 20rpx;
  767. .top-left {
  768. margin-right: 20rpx;
  769. }
  770. }
  771. }
  772. .content,
  773. .content1,
  774. .content2 {
  775. border-radius: 20rpx;
  776. background: white;
  777. padding: 20rpx;
  778. .title {
  779. font-size: 28rpx;
  780. font-weight: 600;
  781. color: #333333;
  782. }
  783. .row {
  784. display: flex;
  785. justify-content: space-between;
  786. border-bottom: 1px solid #EEEEEE;
  787. padding: 21rpx 0;
  788. .right,
  789. input {
  790. font-size: 28rpx;
  791. color: #333333;
  792. }
  793. }
  794. .row-bottom {
  795. // border: 0;
  796. .right-bottom {
  797. width: 300rpx;
  798. text-align: right;
  799. }
  800. }
  801. }
  802. .content1 {
  803. margin-top: 20rpx;
  804. }
  805. .content2 {
  806. margin-top: 10px;
  807. // display: flex;
  808. align-items: center;
  809. .left {
  810. margin-right: 20px;
  811. }
  812. }
  813. .submit {
  814. width: 40%;
  815. background: #22C572;
  816. border-radius: 10rpx;
  817. }
  818. .edit-btn {
  819. background: #22C572;
  820. width: 100rpx;
  821. height: 50rpx;
  822. margin: 0;
  823. color: white;
  824. }
  825. .has-btn {
  826. align-items: center;
  827. }
  828. .bottom-btn {
  829. padding: 30rpx;
  830. background: #FFFFFF;
  831. width: 92%;
  832. position: fixed;
  833. bottom: 0rpx;
  834. display: flex;
  835. z-index: 9999;
  836. }
  837. </style>