improvedExWaehousingDetail.vue 15 KB

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