edit_quality_testing.vue 14 KB

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