improvedWrehousingDetail.vue 28 KB

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