warehousing.vue 14 KB

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