improvedWrehousingDetail.vue 32 KB

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