edit_quality_testing.vue 13 KB

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