edit_quality_testing.vue 18 KB

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