edit_quality_testing.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <view>
  3. <view class='wrap'>
  4. <view class='title'>基本信息</view>
  5. <view class="c-row b-b">
  6. <view class="title">仓库</view>
  7. <view class="con-list">
  8. {{gridList.warehouseName}}
  9. </view>
  10. </view>
  11. <view class="c-row b-b">
  12. <view class="title">编号</view>
  13. <view class="con-list">
  14. {{gridList.qualityNo}}
  15. </view>
  16. </view>
  17. <view class="c-row b-b">
  18. <view class="title">客户</view>
  19. <view class="con-list">
  20. {{gridList.customerName}}({{gridList.customerPhone}})
  21. </view>
  22. </view>
  23. <view class="c-row b-b">
  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 b-b">
  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 b-b">
  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 b-b">
  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 b-b">
  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 b-b">
  60. <view class="title">货名</view>
  61. <view class="con-list">
  62. {{gridList.goodsName}}
  63. </view>
  64. </view>
  65. <view class="c-row b-b">
  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'>化验信息</view>
  80. <view class="c-row b-b">
  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 b-b">
  89. <view class="title">水分(%)</view>
  90. <view class="con-list">
  91. <input v-model='gridList.waterContent' placeholder="请输入水分占比"
  92. name="input"></input>
  93. </view>
  94. </view>
  95. <view class="c-row b-b">
  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 b-b">
  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 b-b">
  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 b-b">
  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 b-b">
  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. managementType:'',
  177. warehouseName: '',
  178. warehouseList:[],
  179. showTran: true,
  180. companyId: 1,
  181. current: 4,
  182. gradeList:[
  183. {key:1,value:'一等品'},
  184. {key:2,value:'二等品'},
  185. {key:3,value:'三等品'},
  186. {key:4,value:'等外'},
  187. ],
  188. cangid:''
  189. }
  190. },
  191. // #ifndef MP
  192. onNavigationBarButtonTap(e) {
  193. const index = e.index;
  194. if (index === 0) {
  195. this.navTo('/pages/set/set');
  196. } else if (index === 1) {
  197. // #ifdef APP-PLUS
  198. const pages = getCurrentPages();
  199. const page = pages[pages.length - 1];
  200. const currentWebview = page.$getAppWebview();
  201. currentWebview.hideTitleNViewButtonRedDot({
  202. index
  203. });
  204. // #endif
  205. uni.navigateTo({
  206. url: '/pages/notice/notice'
  207. })
  208. }
  209. },
  210. // #endif
  211. computed: {
  212. ...mapState(['hasLogin', 'userInfo']),
  213. // 手机号中间4位加*
  214. starUserphone(){
  215. let reg = /^(\d{3})\d{4}(\d{4})$/;
  216. if(this.userphone){
  217. return this.userphone.replace(reg, "$1****$2");
  218. }
  219. }
  220. },
  221. onLoad(options){
  222. this.id=options.id
  223. this.cangid=options.cangid
  224. this.managementType=options.managementType
  225. },
  226. onShow() {
  227. var that = this
  228. this.$api.doRequest('get', '/qualityInspectionManagement/api/getQualityInspection',{
  229. id:this.id
  230. }).then(res => {
  231. if(res.data.data){
  232. let data = res.data.data
  233. that.gridList =data
  234. that.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse',{
  235. id:this.cangid
  236. }).then(res => {
  237. that.warehouseList=res.data.data.warehousePositionInfoList
  238. })
  239. }
  240. })
  241. },
  242. methods: {
  243. submit(){
  244. var that = this
  245. if (!this.gridList.qualityNo) {
  246. this.$api.msg('编号不能为空')
  247. return
  248. }
  249. if (!this.gridList.binNumber) {
  250. this.$api.msg('仓位不能为空')
  251. return
  252. }
  253. if (!this.gridList.customerName) {
  254. this.$api.msg('客户不能为空')
  255. return
  256. }
  257. if (!this.gridList.storageTagNo) {
  258. this.$api.msg('囤位号不能为空')
  259. return
  260. }
  261. if (this.gridList.storageTagNo.length > 10) {
  262. this.$api.msg('囤位号不能为空')
  263. return
  264. }
  265. if (!this.gridList.carNumber) {
  266. this.$api.msg('车牌号不能为空')
  267. return
  268. }
  269. if (this.gridList.carNumber.length > 7) {
  270. this.$api.msg('车牌号输入错误')
  271. return
  272. }
  273. if (!this.gridList.goodsName) {
  274. this.$api.msg('货名不能为空')
  275. return
  276. }
  277. if (this.gridList.buckleWeightRatio < 0 ||this.gridList.buckleWeightRatio > 2) {
  278. this.$api.msg('扣重比输入错误')
  279. return
  280. }
  281. if (
  282. String(this.gridList.buckleWeightRatio).indexOf('.') != -1 &&
  283. String(this.gridList.buckleWeightRatio).length -
  284. (String(this.gridList.buckleWeightRatio).indexOf('.') + 1) > 2)
  285. {
  286. this.$api.msg('扣重比输入错误')
  287. return
  288. }
  289. if (!this.gridList.type) {
  290. this.$api.msg('类型不能为空')
  291. return
  292. }
  293. if (!this.gridList.natureOfGrainPurchase) {
  294. this.$api.msg('购粮性质不能为空')
  295. return
  296. }
  297. if (!this.gridList.grade) {
  298. this.$api.msg('等级不能为空')
  299. return
  300. }
  301. if (!this.gridList.impurity) {
  302. this.$api.msg('杂质不能为空')
  303. return
  304. }
  305. if (!this.gridList.waterContent) {
  306. this.$api.msg('水分不能为空')
  307. return
  308. }
  309. if (!this.gridList.mildewGrain) {
  310. this.$api.msg('霉变粒不能为空')
  311. return
  312. }
  313. if (!this.gridList.bulkDensity) {
  314. this.$api.msg('容重不能为空')
  315. return
  316. }
  317. if (!this.gridList.jiaorenli) {
  318. this.$api.msg('热损伤不能为空')
  319. return
  320. }
  321. if (!this.gridList.imperfectGrain) {
  322. this.$api.msg('不完整粒不能为空')
  323. return
  324. }
  325. uni.showModal({
  326. content: "确定提交质检信息?",
  327. showCancel: true,
  328. confirmText: '提交',
  329. success: function(res) {
  330. if (res.confirm) {
  331. that.$api.doRequest('post', '/qualityInspectionManagement/api/editQualityInspection',that.gridList).then(res => {
  332. if(res.data.code==200){
  333. that.$api.msg('编辑质检成功')
  334. uni.navigateBack({
  335. })
  336. }
  337. })
  338. }
  339. }
  340. })
  341. },
  342. gradepicker(e){
  343. console.log(e)
  344. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  345. this.gridList.grade=this.gradeList[e[0]].value
  346. this.gridList.gradeKey=this.gradeList[e[0]].key
  347. },
  348. binNumberpicker(e){
  349. this.gridList.binNumber=this.warehouseList[e[0]].binNumber
  350. },
  351. del(item){
  352. this.$api.doRequest('get', '/qualityInspectionManagement/api/deleteQualityInspection',{
  353. id:item.id
  354. }).then(res => {
  355. if(res.data.code==200){
  356. this.$api.msg('删除成功')
  357. }else{
  358. this.$api.msg('系统异常,请联系管理员')
  359. }
  360. })
  361. },
  362. contactUs() {
  363. const that = this
  364. uni.makePhoneCall({
  365. // 手机号
  366. phoneNumber: '18241771147',
  367. // 成功回调
  368. success: (res) => {},
  369. // 失败回调
  370. fail: (res) => {}
  371. });
  372. },
  373. loadData() {
  374. // const that = this
  375. // if(uni.getStorageSync("PageCur")){
  376. // that.PageCur = uni.getStorageSync("PageCur");
  377. // }
  378. // that.userInfoTmp = uni.getStorageSync("userInfo")
  379. // uni.showLoading({
  380. // title: '正在加载',
  381. // mask:true
  382. // })
  383. // that.$api.request('integral', 'getIndexData', failres => {
  384. // that.$api.msg(failres.errmsg)
  385. // uni.hideLoading()
  386. // }).then(res => {
  387. // let data = res.data
  388. // uni.setStorageSync("message", data.message);
  389. // uni.setStorageSync("task", data.task);
  390. // uni.setStorageSync("contract", data.contract);
  391. // uni.setStorageSync('showTran', data.showTran);
  392. // that.showTran = data.showTran
  393. // that.gridList[4].tips = data.task
  394. // that.gridList[2].tips = data.contract
  395. // that.companyId = data.companyId
  396. // uni.hideLoading()
  397. // })
  398. },
  399. confirm() {
  400. const that = this
  401. if (!that.inputContent) {
  402. that.$api.msg('输入不能为空')
  403. return
  404. }
  405. let obj = {}
  406. obj[that.feild] = that.inputContent
  407. that.$api.request('user', 'syncUserInfo', obj).then(res => {
  408. that.userInfo.nickname = that.inputContent
  409. that.inputContent = ''
  410. that.$store.commit('login', that.userInfo)
  411. })
  412. },
  413. cancel() {
  414. this.inputShow = false
  415. this.inputStatus = 'none'
  416. this.genderShow = false
  417. },
  418. myAccount() {
  419. uni.navigateTo({
  420. url: `/pageA/pages/contract`
  421. })
  422. },
  423. /**
  424. * 统一跳转接口,拦截未登录路由
  425. * navigator标签现在默认没有转场动画,所以用view
  426. */
  427. navTo(url) {
  428. if (!this.hasLogin) {
  429. url = '/pages/public/login';
  430. }
  431. uni.navigateTo({
  432. url
  433. })
  434. },
  435. mycarClick(carNo) {
  436. this.modalName = null
  437. uni.navigateTo({
  438. url: `/pageB/car/mycar_detail?carNo=${carNo}`
  439. })
  440. },
  441. scanCode() {
  442. uni.scanCode({
  443. success: function(res) {
  444. uni.navigateTo({
  445. url: res.result
  446. })
  447. }
  448. })
  449. },
  450. hideModal(e) {
  451. this.modalName = null
  452. },
  453. }
  454. }
  455. </script>
  456. <style lang='scss' scoped>
  457. page{
  458. background:#F5F6FA;
  459. }
  460. .c-row {
  461. display: -webkit-box;
  462. display: -webkit-flex;
  463. display: flex;
  464. -webkit-box-align: center;
  465. -webkit-align-items: center;
  466. align-items: center;
  467. padding: 10rpx 30rpx;
  468. position: relative;
  469. .title {
  470. /* color: #9698A2; */
  471. }
  472. .title-black {
  473. color: #333;
  474. }
  475. }
  476. .con-list {
  477. -webkit-box-flex: 1;
  478. -webkit-flex: 1;
  479. flex: 1;
  480. display: -webkit-box;
  481. display: -webkit-flex;
  482. display: flex;
  483. -webkit-box-orient: vertical;
  484. -webkit-box-direction: normal;
  485. -webkit-flex-direction: column;
  486. flex-direction: column;
  487. color: #303133;
  488. line-height: 40rpx;
  489. text-align: right;
  490. padding-right: 20rpx;
  491. }
  492. .wrap{
  493. padding-bottom:10px;
  494. font-size:14px;
  495. background:#fff;margin:10px;border-radius:10px;
  496. input{
  497. font-size:14px;
  498. }
  499. >.title{
  500. padding:10px 16px;
  501. }
  502. .b-b:after{
  503. border-bottom:1px solid #eee;
  504. }
  505. }
  506. .footer{
  507. background:#fff;
  508. position:fixed;
  509. bottom:0;
  510. width:100%;
  511. padding:20px 10px;
  512. z-index:10;
  513. .button{
  514. background:#22C572;
  515. width:90%;
  516. margin:0 auto;
  517. padding:10px;
  518. color:#fff;
  519. text-align:center;
  520. border-radius: 30px;
  521. }
  522. }
  523. </style>