edit_quality_testing.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <view>
  3. <view class='wrap'>
  4. <view class='title_b'>基本信息</view>
  5. <view class="c-row ">
  6. <view class="title">仓库</view>
  7. <view class="con-list">
  8. {{gridList.warehouseName}}
  9. </view>
  10. </view>
  11. <view class="c-row ">
  12. <view class="title">编号</view>
  13. <view class="con-list">
  14. {{gridList.qualityNo}}
  15. </view>
  16. </view>
  17. <view class="c-row ">
  18. <view class="title">客户</view>
  19. <view class="con-list">
  20. {{gridList.customerName}}({{gridList.customerPhone}})
  21. </view>
  22. </view>
  23. <view class="c-row ">
  24. <view class="title">车牌号</view>
  25. <view class="con-list">
  26. <input :disabled='flag==1' v-model='gridList.carNumber' placeholder="请输入车牌号"
  27. name="input"></input>
  28. </view>
  29. </view>
  30. <view v-if="gridList.paramType != '1'" class="c-row ">
  31. <view class="title">扣重比</view>
  32. <view class="con-list">
  33. <input :disabled='flag==1' v-model='gridList.buckleWeightRatio' placeholder="请输入扣重比"
  34. name="input"></input>
  35. </view>
  36. </view>
  37. <view v-else class="c-row ">
  38. <view class="title">扣杂</view>
  39. <view class="con-list">
  40. <input :disabled='flag==1' v-model='gridList.buckleMiscellaneous' placeholder="初检扣杂" @input="waterContentChange"
  41. name="input"></input>
  42. <input v-if='flag==0' value='未复检' disabled placeholder="复检扣杂"
  43. name="input"></input>
  44. <input v-else :disabled='flag!=1' v-model='gridList.reBuckleMiscellaneous' placeholder="复检扣杂"
  45. name="input"></input>
  46. </view>
  47. </view>
  48. <view class="c-row ">
  49. <view class="title">购粮性质</view>
  50. <view class="con-list">
  51. <input :disabled='flag==1' v-model='gridList.natureOfGrainPurchase' placeholder="请输入购粮性质"
  52. name="input"></input>
  53. </view>
  54. </view>
  55. <view class="c-row ">
  56. <view class="title">仓位号</view>
  57. <view class="con-list">
  58. <u-picker :range="warehouseList" range-key="binNumber" @confirm='binNumberpicker($event)' v-model="show" mode="selector" >
  59. </u-picker>
  60. <view v-if='flag!=1' @click='show=true'>{{gridList.binNumber}}</view>
  61. <view v-else>{{gridList.binNumber}}</view>
  62. </view>
  63. </view>
  64. <view class="c-row ">
  65. <view class="title">囤位号</view>
  66. <view class="con-list">
  67. <input :disabled='flag==1' v-model='gridList.storageTagNo' placeholder="请输入囤位号"
  68. name="input"></input>
  69. </view>
  70. </view>
  71. <view class="c-row ">
  72. <view class="title">货名</view>
  73. <view class="con-list">
  74. {{gridList.goodsName}}
  75. </view>
  76. </view>
  77. <view class="c-row ">
  78. <view class="title">类型</view>
  79. <view class="con-list">
  80. {{gridList.type}}
  81. </view>
  82. </view>
  83. <view class="c-row">
  84. <view class="title">净重单价(元/公斤)</view>
  85. <view class="con-list">
  86. <input :disabled='flag==1' v-model='gridList.tidalGrainPrice' disabled placeholder="自动获取,不可编辑"
  87. name="input"></input>
  88. </view>
  89. </view>
  90. </view>
  91. <view style='margin-bottom:100px;' class='wrap'>
  92. <view class='title_b'>化验信息</view>
  93. <view class="c-row ">
  94. <view class="title">等级</view>
  95. <view class="con-list">
  96. <u-picker :range="gradeList" range-key="value" @confirm='gradepicker($event)' v-model="show1" mode="selector" >
  97. </u-picker>
  98. <view v-if='flag!=1' @click='show1=true'>{{gridList.grade?gridList.grade:'请选择等级'}}</view>
  99. <view v-else>{{gridList.grade}}</view>
  100. </view>
  101. </view>
  102. <view class="c-row ">
  103. <view class="title">水分(%)</view>
  104. <view class="con-list">
  105. <input :disabled='flag==1' v-model='gridList.waterContent' placeholder="初检水分" @input="waterContentChange"
  106. name="input"></input>
  107. <input v-if='flag==0' value='未复检' disabled placeholder="复检水分"
  108. name="input"></input>
  109. <input :disabled='flag!=1' v-else v-model='gridList.reWaterContent' placeholder="复检水分"
  110. name="input"></input>
  111. </view>
  112. </view>
  113. <view class="c-row ">
  114. <view class="title">容重(克/升)</view>
  115. <view class="con-list">
  116. <input :disabled='flag==1' v-model='gridList.bulkDensity' placeholder="请输入容重"
  117. name="input"></input>
  118. </view>
  119. </view>
  120. <view class="c-row ">
  121. <view class="title">不完善粒(%)</view>
  122. <view class="con-list">
  123. <input :disabled='flag==1' v-model='gridList.imperfectGrain' placeholder="请输入不完整粒占比"
  124. name="input"></input>
  125. </view>
  126. </view>
  127. <view class="c-row ">
  128. <view class="title">杂质(%)</view>
  129. <view class="con-list">
  130. <input :disabled='flag==1' v-model='gridList.impurity' placeholder="请输入杂质占比"
  131. name="input"></input>
  132. </view>
  133. </view>
  134. <view class="c-row ">
  135. <view class="title">霉变粒(%)</view>
  136. <view class="con-list">
  137. <input :disabled='flag==1' v-model='gridList.mildewGrain' placeholder="请输入霉变粒占比"
  138. name="input"></input>
  139. </view>
  140. </view>
  141. <view class="c-row ">
  142. <view class="title">热损伤(%)</view>
  143. <view class="con-list">
  144. <input :disabled='flag==1' v-model='gridList.jiaorenli' placeholder="请输入热损伤占比"
  145. name="input"></input>
  146. </view>
  147. </view>
  148. </view>
  149. <view class="footer">
  150. <view @click='submit' class="button">提交</view>
  151. </view>
  152. </view>
  153. </template>
  154. <script>
  155. import dragButton from "@/components/drag-button/drag-button.vue";
  156. import {
  157. mapState
  158. } from 'vuex';
  159. let startY = 0,
  160. moveY = 0,
  161. pageAtTop = true;
  162. export default {
  163. components: {
  164. dragButton
  165. },
  166. data() {
  167. return {
  168. inputShow: false,
  169. modalName: '',
  170. mycarStyle: '',
  171. feild: undefined,
  172. id:0,
  173. show:false,
  174. selector:[],
  175. show1:false,
  176. inputContent: '',
  177. coverTransform: 'translateY(0px)',
  178. coverTransition: '0s',
  179. moving: false,
  180. footprintList: [],
  181. searchKeyWord:'',
  182. isVip: false,
  183. flag:0,
  184. userInfoTmp: [],
  185. inputStatus: 'none',
  186. carInfo: [],
  187. gridCol: 4,
  188. pageSize:10,
  189. currentPage:1,
  190. gridBorder: false,
  191. headUrl:"../../static/img/myimg/YongHu@3x.png",
  192. userphone:"",
  193. username:"请更改昵称",
  194. gridList: {
  195. natureOfGrainPurchase:'贸易粮',
  196. type:'潮粮',
  197. tidalGrainPrice:'',
  198. dryGrainPrice:''
  199. },
  200. managementType:'',
  201. warehouseName: '',
  202. warehouseList:[],
  203. showTran: true,
  204. companyId: 1,
  205. current: 4,
  206. gradeList:[
  207. {key:1,value:'一等品'},
  208. {key:2,value:'二等品'},
  209. {key:3,value:'三等品'},
  210. {key:4,value:'等外'},
  211. ],
  212. cangid:''
  213. }
  214. },
  215. // #ifndef MP
  216. onNavigationBarButtonTap(e) {
  217. const index = e.index;
  218. if (index === 0) {
  219. this.navTo('/pages/set/set');
  220. } else if (index === 1) {
  221. // #ifdef APP-PLUS
  222. const pages = getCurrentPages();
  223. const page = pages[pages.length - 1];
  224. const currentWebview = page.$getAppWebview();
  225. currentWebview.hideTitleNViewButtonRedDot({
  226. index
  227. });
  228. // #endif
  229. uni.navigateTo({
  230. url: '/pages/notice/notice'
  231. })
  232. }
  233. },
  234. // #endif
  235. computed: {
  236. ...mapState(['hasLogin', 'userInfo']),
  237. // 手机号中间4位加*
  238. starUserphone(){
  239. let reg = /^(\d{3})\d{4}(\d{4})$/;
  240. if(this.userphone){
  241. return this.userphone.replace(reg, "$1****$2");
  242. }
  243. }
  244. },
  245. onLoad(options){
  246. this.id=options.id
  247. this.flag=options.flag
  248. this.cangid=options.cangid
  249. this.managementType=options.managementType
  250. },
  251. onShow() {
  252. var that = this
  253. this.$api.doRequest('get', '/qualityInspectionManagement/api/getQualityInspection',{
  254. id:this.id
  255. }).then(res => {
  256. if(res.data.data){
  257. let data = res.data.data
  258. that.gridList =data
  259. that.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse',{
  260. id:this.cangid
  261. }).then(res => {
  262. that.warehouseList=res.data.data.warehousePositionInfoList
  263. })
  264. }
  265. })
  266. this.gridList.grade=this.gradeList[0].value
  267. this.gridList.gradeKey=this.gradeList[0].key
  268. },
  269. methods: {
  270. waterContentChange() {
  271. var that = this
  272. if(this.gridList.goodsName && this.cangid){
  273. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice',{
  274. warehouseId:this.cangid,
  275. goodsName:this.gridList.goodsName
  276. }).then(res => {
  277. that.gridList.dryGrainPrice = res.data.data
  278. })
  279. }
  280. if (this.gridList.goodsName) {
  281. for (var i = 0; i < this.purchasePriceList.length; i++) {
  282. if (this.purchasePriceList[i].goodsName == this.gridList.goodsName) {
  283. this.gridList.buckleWeightRatio = this.purchasePriceList[i].deductWeight
  284. this.gridList.paramType = this.purchasePriceList[i].paramType
  285. }
  286. }
  287. }
  288. var numReg = /^[0-9]*$/
  289. var numRe = new RegExp(numReg)
  290. //潮粮单价改变事件
  291. if (
  292. this.gridList.goodsName &&
  293. this.gridList.waterContent &&
  294. this.gridList.grade&&
  295. numRe.test(this.gridList.waterContent)
  296. ) {
  297. this.$api.doRequest('get', '/purchasePrice/tidalGrainPrice',{
  298. warehouseId:this.cangid,
  299. goodsName:this.gridList.goodsName,
  300. waterContent: this.gridList.waterContent,
  301. grade: this.gridList.grade,
  302. }).then(res => {
  303. if(that.gridList.paramType == '1'){
  304. that.gridList.tidalGrainPrice = parseFloat(parseFloat(res.data.data) - parseFloat(that.gridList.buckleMiscellaneous)/100*parseFloat(that.gridList.dryGrainPrice)).toFixed(4)
  305. if(!that.gridList.tidalGrainPrice){
  306. that.gridList.tidalGrainPrice = ''
  307. }
  308. }else{
  309. that.gridList.tidalGrainPrice = res.data.data
  310. }
  311. })
  312. }
  313. },
  314. submit(){
  315. this.gridList.flag=this.flag
  316. // if(this.flag==2){
  317. // this.gridList.reInspector=this.userInfo.userName
  318. // }
  319. var that = this
  320. if (!this.gridList.qualityNo) {
  321. this.$api.msg('编号不能为空')
  322. return
  323. }
  324. if (!this.gridList.binNumber) {
  325. this.$api.msg('仓位不能为空')
  326. return
  327. }
  328. if (!this.gridList.customerName) {
  329. this.$api.msg('客户不能为空')
  330. return
  331. }
  332. if (!this.gridList.storageTagNo) {
  333. this.$api.msg('囤位号不能为空')
  334. return
  335. }
  336. if (this.gridList.storageTagNo.length > 10) {
  337. this.$api.msg('囤位号不能为空')
  338. return
  339. }
  340. if (!this.gridList.carNumber) {
  341. this.$api.msg('车牌号不能为空')
  342. return
  343. }
  344. if (this.gridList.carNumber.length > 7) {
  345. this.$api.msg('车牌号输入错误')
  346. return
  347. }
  348. if (!this.gridList.goodsName) {
  349. this.$api.msg('货名不能为空')
  350. return
  351. }
  352. if (this.gridList.paramType!=1&&this.gridList.buckleWeightRatio < 0 ||this.gridList.paramType!=1&&this.gridList.buckleWeightRatio > 2) {
  353. this.$api.msg('扣重比输入错误')
  354. return
  355. }
  356. if (
  357. this.gridList.paramType!=1&&String(this.gridList.buckleWeightRatio).indexOf('.') != -1 &&
  358. String(this.gridList.buckleWeightRatio).length -
  359. (String(this.gridList.buckleWeightRatio).indexOf('.') + 1) > 2)
  360. {
  361. this.$api.msg('扣重比输入错误')
  362. return
  363. }
  364. if (this.flag==0&&this.gridList.paramType==1&&this.gridList.buckleMiscellaneous < 0 ||this.flag==0&&this.gridList.paramType==1&&this.gridList.buckleMiscellaneous > 50) {
  365. this.$api.msg('初检扣杂输入错误')
  366. return
  367. }
  368. if (this.flag==1&&this.gridList.paramType==1&&this.gridList.reBuckleMiscellaneous < 0 ||this.flag==0&&this.gridList.paramType==1&&this.gridList.reBuckleMiscellaneous > 50) {
  369. this.$api.msg('复检扣杂输入错误')
  370. return
  371. }
  372. if (!this.gridList.type) {
  373. this.$api.msg('类型不能为空')
  374. return
  375. }
  376. if (!this.gridList.natureOfGrainPurchase) {
  377. this.$api.msg('购粮性质不能为空')
  378. return
  379. }
  380. if (!this.gridList.grade) {
  381. this.$api.msg('等级不能为空')
  382. return
  383. }
  384. if (!this.gridList.impurity) {
  385. this.$api.msg('杂质不能为空')
  386. return
  387. }
  388. if (!this.gridList.waterContent) {
  389. this.$api.msg('初检水分不能为空')
  390. return
  391. }
  392. if (!this.gridList.reWaterContent) {
  393. this.$api.msg('复检水分不能为空')
  394. return
  395. }
  396. if (!this.gridList.mildewGrain) {
  397. this.$api.msg('霉变粒不能为空')
  398. return
  399. }
  400. if (!this.gridList.bulkDensity) {
  401. this.$api.msg('容重不能为空')
  402. return
  403. }
  404. if (!this.gridList.jiaorenli) {
  405. this.$api.msg('热损伤不能为空')
  406. return
  407. }
  408. if (!this.gridList.imperfectGrain) {
  409. this.$api.msg('不完整粒不能为空')
  410. return
  411. }
  412. uni.showModal({
  413. content: "确定提交质检信息?",
  414. showCancel: true,
  415. confirmText: '提交',
  416. success: function(res) {
  417. if (res.confirm) {
  418. that.$api.doRequest('post', '/qualityInspectionManagement/api/editQualityInspection',that.gridList).then(res => {
  419. if(res.data.code==200){
  420. that.$api.msg('编辑质检成功')
  421. uni.navigateBack({
  422. })
  423. }
  424. })
  425. }
  426. }
  427. })
  428. },
  429. gradepicker(e){
  430. console.log(e)
  431. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  432. this.gridList.grade=this.gradeList[e[0]].value
  433. this.gridList.gradeKey=this.gradeList[e[0]].key
  434. this.waterContentChange()
  435. },
  436. binNumberpicker(e){
  437. this.gridList.binNumber=this.warehouseList[e[0]].binNumber
  438. },
  439. del(item){
  440. this.$api.doRequest('get', '/qualityInspectionManagement/api/deleteQualityInspection',{
  441. id:item.id
  442. }).then(res => {
  443. if(res.data.code==200){
  444. this.$api.msg('删除成功')
  445. }else{
  446. this.$api.msg('系统异常,请联系管理员')
  447. }
  448. })
  449. },
  450. contactUs() {
  451. const that = this
  452. uni.makePhoneCall({
  453. // 手机号
  454. phoneNumber: '18241771147',
  455. // 成功回调
  456. success: (res) => {},
  457. // 失败回调
  458. fail: (res) => {}
  459. });
  460. },
  461. loadData() {
  462. // const that = this
  463. // if(uni.getStorageSync("PageCur")){
  464. // that.PageCur = uni.getStorageSync("PageCur");
  465. // }
  466. // that.userInfoTmp = uni.getStorageSync("userInfo")
  467. // uni.showLoading({
  468. // title: '正在加载',
  469. // mask:true
  470. // })
  471. // that.$api.request('integral', 'getIndexData', failres => {
  472. // that.$api.msg(failres.errmsg)
  473. // uni.hideLoading()
  474. // }).then(res => {
  475. // let data = res.data
  476. // uni.setStorageSync("message", data.message);
  477. // uni.setStorageSync("task", data.task);
  478. // uni.setStorageSync("contract", data.contract);
  479. // uni.setStorageSync('showTran', data.showTran);
  480. // that.showTran = data.showTran
  481. // that.gridList[4].tips = data.task
  482. // that.gridList[2].tips = data.contract
  483. // that.companyId = data.companyId
  484. // uni.hideLoading()
  485. // })
  486. },
  487. confirm() {
  488. const that = this
  489. if (!that.inputContent) {
  490. that.$api.msg('输入不能为空')
  491. return
  492. }
  493. let obj = {}
  494. obj[that.feild] = that.inputContent
  495. that.$api.request('user', 'syncUserInfo', obj).then(res => {
  496. that.userInfo.nickname = that.inputContent
  497. that.inputContent = ''
  498. that.$store.commit('login', that.userInfo)
  499. })
  500. },
  501. cancel() {
  502. this.inputShow = false
  503. this.inputStatus = 'none'
  504. this.genderShow = false
  505. },
  506. myAccount() {
  507. uni.navigateTo({
  508. url: `/pageA/pages/contract`
  509. })
  510. },
  511. /**
  512. * 统一跳转接口,拦截未登录路由
  513. * navigator标签现在默认没有转场动画,所以用view
  514. */
  515. navTo(url) {
  516. if (!this.hasLogin) {
  517. url = '/pages/public/login';
  518. }
  519. uni.navigateTo({
  520. url
  521. })
  522. },
  523. mycarClick(carNo) {
  524. this.modalName = null
  525. uni.navigateTo({
  526. url: `/pageB/car/mycar_detail?carNo=${carNo}`
  527. })
  528. },
  529. scanCode() {
  530. uni.scanCode({
  531. success: function(res) {
  532. uni.navigateTo({
  533. url: res.result
  534. })
  535. }
  536. })
  537. },
  538. hideModal(e) {
  539. this.modalName = null
  540. },
  541. }
  542. }
  543. </script>
  544. <style lang='scss' scoped>
  545. .title_b {
  546. margin: 20rpx 20rpx 0rpx 20rpx;
  547. padding: 20rpx 10rpx 20rpx 10rpx;
  548. font-size: 18px;
  549. font-weight: 550;
  550. }
  551. page{
  552. background:#F5F6FA;
  553. }
  554. .wrap{
  555. padding-bottom:10px;
  556. font-size:14px;
  557. background:#fff;margin:10px;border-radius:10px;
  558. input{
  559. font-size:14px;
  560. }
  561. >.title{
  562. padding:10px 16px;
  563. }
  564. .b-b:after{
  565. border-bottom:1px solid #eee;
  566. }
  567. }
  568. .footer{
  569. background:#fff;
  570. position:fixed;
  571. bottom:0;
  572. width:100%;
  573. padding:20px 10px;
  574. z-index:10;
  575. .button{
  576. background:#22C572;
  577. width:90%;
  578. margin:0 auto;
  579. padding:10px;
  580. color:#fff;
  581. text-align:center;
  582. border-radius: 30px;
  583. }
  584. }
  585. .c-row {
  586. display: -webkit-box;
  587. display: -webkit-flex;
  588. display: flex;
  589. -webkit-box-align: center;
  590. -webkit-align-items: center;
  591. align-items: center;
  592. padding: 20rpx 30rpx;
  593. position: relative;
  594. }
  595. .con-list {
  596. -webkit-box-flex: 1;
  597. -webkit-flex: 1;
  598. flex: 1;
  599. display: -webkit-box;
  600. display: -webkit-flex;
  601. display: flex;
  602. -webkit-box-orient: vertical;
  603. -webkit-box-direction: normal;
  604. -webkit-flex-direction: column;
  605. flex-direction: column;
  606. color: #303133;
  607. line-height: 40rpx;
  608. text-align: right;
  609. padding-right: 20rpx;
  610. }
  611. input:disabled {
  612. color:#ccc;
  613. }
  614. </style>