improvedWrehousingDetail.vue 33 KB

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