edit_quality_testing.vue 15 KB

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