edit_quality_testing.vue 17 KB

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