improvedWrehousingDetail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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. <!-- <view >{{detailData.inOutDate ? detailData.inOutDate:"请选择日期" }}</view> -->
  85. </u-picker>
  86. <!-- <u-calendar v-model="show4" mode="date" @change='dateChange'></u-calendar> -->
  87. </view>
  88. <view class="row">
  89. <view class="left">入库类型</view>
  90. <view @click='show5=true'>{{detailData.inOutType}}</view>
  91. <u-picker :range="warehousingTypeList" range-key="constValue" @confirm='warehousingTypePicker($event)'
  92. v-model="show5" mode="selector">
  93. </u-picker>
  94. </view>
  95. <view class="row row-bottom">
  96. <view class="left">车牌号</view>
  97. <input v-if="!isPC" @input='' v-model='detailData.carNo' class="right-bottom"
  98. placeholder="请输入车牌号"></input>
  99. <view @click='slectCarNo' v-if="isPC">{{detailData.carNo}}</view>
  100. </view>
  101. <view class="row row-bottom has-btn">
  102. <view class="left">成本(元/吨)</view>
  103. <input v-if="detailData.inOutType=='采购入库'" v-model='detailData.unitContractPrice' class="right-bottom"
  104. placeholder="自动获取" :disabled="isEditCB"></input>
  105. <input v-if="detailData.inOutType!='采购入库'" v-model='detailData.cost' class="right-bottom"
  106. placeholder="自动获取" :disabled="isEditCB"></input>
  107. <u-button class="edit-btn" hover-class="none" @click="editCB">编辑</u-button>
  108. </view>
  109. <view class="row row-bottom has-btn">
  110. <view class="left">运费(元/吨)</view>
  111. <input @input='' v-model='detailData.freight' :disabled="isEditYF" class="right-bottom"
  112. placeholder="自动获取"></input>
  113. <u-button class="edit-btn" hover-class="none" @click="editYF">编辑</u-button>
  114. </view>
  115. </view>
  116. <view class="content2">
  117. <view class="left">上传磅单</view>
  118. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1" :file-list="imgUrl"
  119. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  120. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  121. </view>
  122. <view class="content1">
  123. <view class="title">
  124. 质检数据(选填)
  125. </view>
  126. <view class="row row-bottom">
  127. <view class="left">质检员</view>
  128. <input @input='' v-model='detailData.warehouseInOutDetail.qualityInspector' class="right-bottom"
  129. placeholder="输入质检员姓名"></input>
  130. </view>
  131. <view class="row row-bottom">
  132. <view class="left">水分(%)</view>
  133. <input @input='' v-model='detailData.warehouseInOutDetail.waterContent' class="right-bottom"
  134. placeholder="输入水分占比"></input>
  135. </view>
  136. <view class="row row-bottom" style="border: 0;">
  137. <view class="left">容重(克/升)</view>
  138. <input v-model='detailData.warehouseInOutDetail.bulkDensity' class="right-bottom"
  139. placeholder="输入容重"></input>
  140. </view>
  141. <view class="row row-bottom">
  142. <view class="left">热损伤(%)</view>
  143. <input @input='' v-model='detailData.warehouseInOutDetail.jiaorenli' class="right-bottom"
  144. placeholder="输入热损伤占比"></input>
  145. </view>
  146. <view class="row row-bottom">
  147. <view class="left">杂质(%)</view>
  148. <input @input='' v-model='detailData.warehouseInOutDetail.impurity' class="right-bottom"
  149. placeholder="输入杂质占比"></input>
  150. </view>
  151. <view class="row row-bottom">
  152. <view class="left">霉变粒(%)</view>
  153. <input @input='' v-model='detailData.warehouseInOutDetail.mildewGrain' class="right-bottom"
  154. placeholder="输入霉变粒占比"></input>
  155. </view>
  156. <view class="row row-bottom">
  157. <view class="left">不完善粒(%)</view>
  158. <input @input='' v-model='detailData.warehouseInOutDetail.imperfectGrain' class="right-bottom"
  159. placeholder="输入不完善粒占比"></input>
  160. </view>
  161. </view>
  162. <u-toast ref="uToast" />
  163. <view class="bottom-btn">
  164. <u-button type="primary" class="submit" hover-class="none" @click="submit(1)">暂存</u-button>
  165. <u-button type="primary" class="submit" hover-class="none" @click="submit(2)">提交</u-button>
  166. </view>
  167. </view>
  168. </template>
  169. <script>
  170. import {
  171. mapState
  172. } from 'vuex';
  173. import upload from '@/components/upload.vue';
  174. import helper from '@/common/helper.js';
  175. export default {
  176. components: {
  177. upload
  178. },
  179. data() {
  180. return {
  181. show: false,
  182. show1: false,
  183. show2: false,
  184. show3: false,
  185. show4: false,
  186. show5: false,
  187. show6: false,
  188. isPC: true,
  189. params: {
  190. year: true,
  191. month: true,
  192. day: true,
  193. hour: true,
  194. minute: true,
  195. second: true
  196. },
  197. isEditCB: 'false',
  198. isEditYF: 'false',
  199. warehouseName: '',
  200. binNumber: '',
  201. contractNoList: [{
  202. contractNo: "123"
  203. }],
  204. typeList: [{
  205. type: "干粮"
  206. },
  207. {
  208. type: "潮粮"
  209. }
  210. ],
  211. pjList: [{
  212. grade: "一等品"
  213. },
  214. {
  215. grade: "二等品"
  216. },
  217. {
  218. grade: "三等品"
  219. },
  220. {
  221. grade: "等外"
  222. }
  223. ],
  224. handlerList: [{
  225. agent: "张三"
  226. },
  227. {
  228. agent: "二等"
  229. },
  230. {
  231. agent: "三等"
  232. },
  233. {
  234. agent: "等外"
  235. }
  236. ],
  237. warehousingTypeList: [],
  238. action: this.$uploadUrl,
  239. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  240. btnLoading: false, //防止重复点击
  241. isAdd: true,
  242. netWeight: 0,
  243. inOutDate1: "",
  244. detailData: {
  245. contractNo: "请选择合同编号",
  246. carNo: '辽H12345',
  247. type: "干粮",
  248. goodsName: "123",
  249. inOutDate: '请输入入库日期',
  250. grade: "一等品",
  251. agent: '请选择经办人',
  252. inOutType: '请选择入库类型',
  253. deductionWeight: 0,
  254. grossWeight: 0,
  255. tare: 0,
  256. deductionAmount: 0,
  257. netWeight: 0,
  258. warehouseInOutDetail: {}
  259. },
  260. imgUrl: []
  261. }
  262. },
  263. onLoad(options) {
  264. this.detailData = JSON.parse(options.data)
  265. this.binNumber = helper.erpWarehouse.binNumber
  266. this.warehouseName = helper.erpWarehouse.warehouseName
  267. this.compId = helper.erpWarehouse.compId
  268. if(this.detailData.addressUrl){
  269. this.imgUrl.push({
  270. url: this.detailData.addressUrl.split(",")[0]
  271. })
  272. }
  273. console.log(this.imgUrl)
  274. console.log(helper.erpWarehouse)
  275. },
  276. computed: {
  277. ...mapState(['hasLogin', 'userInfo']),
  278. },
  279. onShow() {
  280. if (this.detailData.inOutType == '采购入库') {
  281. this.detailData.freight = 0
  282. }
  283. if (!this.detailData.tranCarInfoList) this.detailData.tranCarInfoList = []
  284. if (!this.detailData.contractNo) {
  285. this.detailData.contractNo = '请选择合同编号'
  286. } else {
  287. if (this.detailData.tranCarInfoList.length == 0) {
  288. this.isPC = false
  289. }
  290. }
  291. if (!this.detailData.goodsName) {
  292. this.detailData.goodsName = '货名'
  293. }
  294. // 获取入库类型
  295. this.getrkType()
  296. //获取经办人
  297. this.getPerson()
  298. console.log(this.detailData)
  299. },
  300. watch: {
  301. netWeight: function(v) {
  302. this.pureWeightCount()
  303. },
  304. },
  305. methods: {
  306. //计算纯重
  307. pureWeightCount() {
  308. if (this.netWeight && this.detailData.buckleWeightRatio && this.detailData.solidGrainWater && this
  309. .detailData.tidalGrainWater) {
  310. // 纯重=净重x[100-(潮粮水分-干粮水分)x扣重比]/100
  311. this.detailData.pureWeight = 100 - (this.detailData.tidalGrainWater - this.detailData
  312. .solidGrainWater) * this.netWeight * this.detailData.buckleWeightRatio / 100
  313. this.detailData.pureWeight = this.detailData.pureWeight.toFixed(3)
  314. }
  315. },
  316. getPerson() {
  317. this.$api.doRequest('get', '/staff/query/getStaffListByCompId', {
  318. compId: this.compId
  319. }).then(res => {
  320. this.handlerList = res.data.data
  321. })
  322. },
  323. getrkType() {
  324. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  325. constId: 'CON5'
  326. }).then(res => {
  327. this.warehousingTypeList = res.data.data
  328. })
  329. },
  330. contractNopicker(e) {},
  331. typePicker(e) {
  332. console.log(e)
  333. this.detailData.type = this.typeList[e].type
  334. },
  335. pjPicker(e) {
  336. console.log(e)
  337. },
  338. handlerPicker(e) {
  339. console.log(e)
  340. this.detailData.agent = this.handlerList[e].staffName
  341. },
  342. dateChange(e) {
  343. console.log(e)
  344. this.detailData.inOutDate = e.year + "-" + e.month + "-" + e.day
  345. this.inOutDate1 = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute
  346. },
  347. warehousingTypePicker(e) {
  348. this.detailData.inOutType = this.warehousingTypeList[e].constValue
  349. },
  350. filterFileType(index, lists) {
  351. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  352. lists.splice(index, 1);
  353. // 当前文件不支持
  354. uni.showModal({
  355. title: '暂不支持当前图片类型',
  356. showCancel: false
  357. });
  358. } else {
  359. this.isAdd = false;
  360. }
  361. },
  362. calculate() {
  363. this.netWeight = this.detailData.grossWeight - this.detailData.tare - this.detailData.deductionWeight
  364. },
  365. getImgUrl(res) {
  366. this.detailData.addressUrl = res
  367. console.log(res)
  368. console.log('------------res-----------')
  369. },
  370. onError(error) {
  371. alert(error)
  372. console.log('------------error-----------')
  373. console.log(error)
  374. },
  375. contractNopicker(e) {
  376. // this.detailData.goodsName=this.contractNoList[e[0]].goodsName
  377. // this.detailData.contractNo=this.contractNoList[e[0]].contractNo
  378. },
  379. binNumberpicker(e) {
  380. this.detailData.binNumber = this.positionList[e[0]].binNumber
  381. },
  382. getWeighingManagement() {
  383. this.$api.doRequest('get', '/weighingManagement/getWeighingManagement', {
  384. id: this.id
  385. }).then(res => {
  386. if (res.data.code == 200) {
  387. console.log(res)
  388. this.detailData = res.data.data
  389. }
  390. })
  391. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  392. id: this.cangId
  393. }).then(res => {
  394. if (res.data.code == 200) {
  395. this.positionList = res.data.data.warehousePositionInfoList
  396. }
  397. })
  398. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  399. compId: '',
  400. flag: 5
  401. }).then(res => {
  402. if (res.data.code == 200) {
  403. this.contractNoList = res.data.data
  404. }
  405. })
  406. },
  407. onProgress(e) {
  408. console.log(e)
  409. },
  410. onRemove(index) {},
  411. editCB() {
  412. this.isEditCB = false
  413. },
  414. editYF() {
  415. this.isEditYF = false
  416. },
  417. submit(num) {
  418. if (isNaN(this.detailData.grossWeight) ||
  419. (String(this.detailData.grossWeight).indexOf('.') != -1 &&
  420. String(this.detailData.grossWeight).length -
  421. (String(this.detailData.grossWeight).indexOf('.') + 1) >
  422. 1) ||
  423. this.detailData.grossWeight < 1 ||
  424. this.detailData.grossWeight > 100000
  425. ) {
  426. this.$api.msg('毛重输入错误!')
  427. return
  428. }
  429. this.detailData.baseId = helper.erpWarehouse.warehouseId
  430. this.detailData.warehouseName = helper.erpWarehouse.warehouseName
  431. this.detailData.positionId = helper.erpWarehouse.positionId
  432. this.detailData.binNumber = this.binNumber
  433. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  434. this.detailData.compId = helper.erpWarehouse.compId
  435. this.detailData.netWeight = this.netWeight
  436. this.detailData.backOffice = this.userInfo.userName
  437. this.detailData.backOfficeId = this.userInfo.id
  438. this.detailData.inOutFlag = 2
  439. this.detailData.taskType = "入库任务"
  440. this.detailData.pcFlag = 0
  441. let title = ""
  442. if (num == 1) {
  443. this.detailData.statusFlag = 1
  444. this.detailData.inOutDate = this.inOutDate1
  445. title = "暂存成功"
  446. } else if (num == 2) {
  447. this.detailData.statusFlag = 3
  448. title = "提交成功"
  449. }
  450. let that = this
  451. uni.showModal({
  452. content: "确定提交入库库信息?",
  453. success(res) {
  454. if (res.confirm) {
  455. that.$api.doRequest('post', '/warehouseInOutInfo/InOutWarehouse',
  456. that.detailData).then(res => {
  457. if (res.data.code == 200) {
  458. that.$api.msg(title)
  459. uni.navigateBack()
  460. }
  461. })
  462. }
  463. }
  464. })
  465. },
  466. slectcontractNo() {
  467. uni.navigateTo({
  468. url: '/pages/erp/warehousing/selectContractNo?compId=' + this.compId
  469. })
  470. },
  471. slectCarNo() {
  472. uni.navigateTo({
  473. url: '/pages/erp/warehousing/selectCarNo'
  474. })
  475. },
  476. }
  477. }
  478. </script>
  479. <style scoped lang="scss">
  480. uni-page-body {
  481. overflow: hidden;
  482. }
  483. .warp {
  484. margin: 10rpx;
  485. padding: 20rpx 20rpx 140rpx 20rpx;
  486. .top {
  487. display: flex;
  488. margin-bottom: 20rpx;
  489. .top-left {
  490. margin-right: 20rpx;
  491. }
  492. }
  493. }
  494. .content,
  495. .content1,
  496. .content2 {
  497. border-radius: 20rpx;
  498. background: white;
  499. padding: 20rpx;
  500. .title {
  501. font-size: 28rpx;
  502. font-weight: 600;
  503. color: #333333;
  504. }
  505. .row {
  506. display: flex;
  507. justify-content: space-between;
  508. border-bottom: 1px solid #EEEEEE;
  509. padding: 21rpx 0;
  510. .right,
  511. input {
  512. font-size: 28rpx;
  513. color: #333333;
  514. }
  515. }
  516. .row-bottom {
  517. // border: 0;
  518. .right-bottom {
  519. width: 300rpx;
  520. text-align: right;
  521. }
  522. }
  523. }
  524. .content1 {
  525. margin-top: 20rpx;
  526. }
  527. .content2 {
  528. margin-top: 10px;
  529. display: flex;
  530. align-items: center;
  531. .left {
  532. margin-right: 20px;
  533. }
  534. }
  535. .submit {
  536. width: 40%;
  537. background: #22C572;
  538. border-radius: 10rpx;
  539. }
  540. .edit-btn {
  541. background: #22C572;
  542. width: 100rpx;
  543. height: 50rpx;
  544. margin: 0;
  545. color: white;
  546. }
  547. .has-btn {
  548. align-items: center;
  549. }
  550. .bottom-btn {
  551. width: 92%;
  552. position: fixed;
  553. bottom: 40rpx;
  554. display: flex;
  555. z-index: 2;
  556. }
  557. </style>