add_quality_testing.vue 18 KB

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