edit_quality_testing.vue 14 KB

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