edit_quality_testing.vue 17 KB

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