add_quality_testing.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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='SGRK' + 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. var that = this
  265. this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer',{
  266. compId:'',
  267. authenticationStatusKey:7
  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.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName',{
  280. warehouseId:this.cangid
  281. }).then(res => {
  282. if(res.data.data){
  283. this.goodsList = res.data.data
  284. if(this.goodsList.length > 0){
  285. this.gridList.goodsName=this.goodsList[0].goodsName
  286. }
  287. // for (let i = 0; i < res.data.data.length; i++) {
  288. // this.goodsList.push(res.data.data[i].goodsName)
  289. // }
  290. // if(this.goodsList.some(item=>{return item.goodsName=='玉米'})){
  291. // this.gridList.goodsName='玉米'
  292. // uni.setStorageSync('goodsName',this.gridList.goodsName)
  293. // }else{
  294. // this.gridList.goodsName=this.goodsList[0].goodsName
  295. // uni.setStorageSync('goodsName',this.gridList.goodsName)
  296. // }
  297. }
  298. })
  299. },
  300. methods: {
  301. waterContentChange() {
  302. var that = this
  303. if (this.gridList.goodsName) {
  304. for (var i = 0; i < this.purchasePriceList.length; i++) {
  305. if (this.purchasePriceList[i].goodsName == this.gridList.goodsName) {
  306. this.gridList.buckleWeightRatio = this.purchasePriceList[i].deductWeight
  307. }
  308. }
  309. }
  310. var numReg = /^[0-9]*$/
  311. var numRe = new RegExp(numReg)
  312. //潮粮单价改变事件
  313. if (
  314. this.gridList.goodsName &&
  315. this.gridList.waterContent &&
  316. this.gridList.grade&&
  317. numRe.test(this.gridList.waterContent)
  318. ) {
  319. this.$api.doRequest('get', '/purchasePrice/tidalGrainPrice',{
  320. warehouseId:this.cangid,
  321. goodsName:this.gridList.goodsName,
  322. waterContent: this.gridList.waterContent,
  323. grade: this.gridList.grade,
  324. }).then(res => {
  325. that.gridList.tidalGrainPrice = res.data.data
  326. })
  327. }
  328. },
  329. gocustomer(){
  330. uni.navigateTo({
  331. url:'/pages/erpbusiness/customer'
  332. })
  333. },
  334. getdate() {
  335. var date = new Date()
  336. var year = date.getFullYear() //获取完整的年份(4位)
  337. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  338. var datetime = date.getDate() //获取当前日(1-31)
  339. if (mouth < 10) {
  340. mouth = '0' + mouth
  341. }
  342. if (datetime < 10) {
  343. datetime = '0' + datetime
  344. }
  345. return year + mouth + datetime
  346. },
  347. submit(){
  348. var that = this
  349. if (!this.gridList.qualityNo) {
  350. this.$api.msg('编号不能为空')
  351. return
  352. }
  353. if (!this.gridList.binNumber) {
  354. this.$api.msg('仓位不能为空')
  355. return
  356. }
  357. if (!this.gridList.customerName) {
  358. this.$api.msg('客户不能为空')
  359. return
  360. }
  361. if (!this.gridList.storageTagNo) {
  362. this.$api.msg('囤位号不能为空')
  363. return
  364. }
  365. if (this.gridList.storageTagNo.length > 10) {
  366. this.$api.msg('囤位号不能为空')
  367. return
  368. }
  369. if (!this.gridList.carNumber) {
  370. this.$api.msg('车牌号不能为空')
  371. return
  372. }
  373. if (this.gridList.carNumber.length > 7) {
  374. this.$api.msg('车牌号输入错误')
  375. return
  376. }
  377. if (!this.gridList.goodsName) {
  378. this.$api.msg('货名不能为空')
  379. return
  380. }
  381. if (this.gridList.buckleWeightRatio < 0 ||this.gridList.buckleWeightRatio > 2) {
  382. this.$api.msg('扣重比输入错误')
  383. return
  384. }
  385. if (
  386. String(this.gridList.buckleWeightRatio).indexOf('.') != -1 &&
  387. String(this.gridList.buckleWeightRatio).length -
  388. (String(this.gridList.buckleWeightRatio).indexOf('.') + 1) > 2)
  389. {
  390. this.$api.msg('扣重比输入错误')
  391. return
  392. }
  393. if (!this.gridList.type) {
  394. this.$api.msg('类型不能为空')
  395. return
  396. }
  397. if (!this.gridList.natureOfGrainPurchase) {
  398. this.$api.msg('购粮性质不能为空')
  399. return
  400. }
  401. if (!this.gridList.grade) {
  402. this.$api.msg('等级不能为空')
  403. return
  404. }
  405. if (!this.gridList.impurity) {
  406. this.$api.msg('杂质不能为空')
  407. return
  408. }
  409. if (!this.gridList.waterContent) {
  410. this.$api.msg('水分不能为空')
  411. return
  412. }
  413. if (!this.gridList.mildewGrain) {
  414. this.$api.msg('霉变粒不能为空')
  415. return
  416. }
  417. if (!this.gridList.bulkDensity) {
  418. this.$api.msg('容重不能为空')
  419. return
  420. }
  421. if (!this.gridList.jiaorenli) {
  422. this.$api.msg('热损伤不能为空')
  423. return
  424. }
  425. if (!this.gridList.imperfectGrain) {
  426. this.$api.msg('不完整粒不能为空')
  427. return
  428. }
  429. uni.showModal({
  430. content: "确定提交质检信息?",
  431. showCancel: true,
  432. confirmText: '提交',
  433. success: function(res) {
  434. if (res.confirm) {
  435. that.$api.doRequest('post', '/qualityInspectionManagement/api/addQualityInspection',that.gridList).then(res => {
  436. if(res.data.code==200){
  437. that.$api.msg('提交成功')
  438. uni.navigateBack({
  439. })
  440. }else{
  441. hat.$api.msg('提交失败')
  442. }
  443. })
  444. }
  445. }
  446. })
  447. },
  448. gradepicker(e){
  449. console.log(e)
  450. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  451. this.gridList.grade=this.gradeList[e[0]].value
  452. this.gridList.gradeKey=this.gradeList[e[0]].key
  453. this.waterContentChange()
  454. },
  455. goodspicker(e){
  456. console.log(e)
  457. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  458. this.gridList.goodsName=this.goodsList[e[0]].goodsName
  459. uni.setStorageSync('goodsName',this.gridList.goodsName)
  460. if(this.gridList.type == "干粮" && this.gridList.goodsName){
  461. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice',{
  462. warehouseId:this.cangid,
  463. goodsName:this.gridList.goodsName
  464. }).then(res => {
  465. that.gridList.dryGrainPrice = res.data.data
  466. })
  467. }
  468. this.waterContentChange()
  469. },
  470. typepicker(e){
  471. var that = this
  472. this.gridList.type=this.typeList[e[0]]
  473. if(this.gridList.type == "干粮" &&this.gridList.goodsName){
  474. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice',{
  475. warehouseId:this.cangid,
  476. goodsName:this.gridList.goodsName
  477. }).then(res => {
  478. that.gridList.dryGrainPrice = res.data.data
  479. })
  480. }
  481. },
  482. binNumberpicker(e){
  483. this.gridList.binNumber=this.warehouseList[e[0]].binNumber
  484. },
  485. del(item){
  486. this.$api.doRequest('get', '/qualityInspectionManagement/api/deleteQualityInspection',{
  487. id:item.id
  488. }).then(res => {
  489. if(res.data.code==200){
  490. this.$api.msg('删除成功')
  491. }else{
  492. this.$api.msg('系统异常,请联系管理员')
  493. }
  494. })
  495. },
  496. contactUs() {
  497. const that = this
  498. uni.makePhoneCall({
  499. // 手机号
  500. phoneNumber: '18241771147',
  501. // 成功回调
  502. success: (res) => {},
  503. // 失败回调
  504. fail: (res) => {}
  505. });
  506. },
  507. loadData() {
  508. // const that = this
  509. // if(uni.getStorageSync("PageCur")){
  510. // that.PageCur = uni.getStorageSync("PageCur");
  511. // }
  512. // that.userInfoTmp = uni.getStorageSync("userInfo")
  513. // uni.showLoading({
  514. // title: '正在加载',
  515. // mask:true
  516. // })
  517. // that.$api.request('integral', 'getIndexData', failres => {
  518. // that.$api.msg(failres.errmsg)
  519. // uni.hideLoading()
  520. // }).then(res => {
  521. // let data = res.data
  522. // uni.setStorageSync("message", data.message);
  523. // uni.setStorageSync("task", data.task);
  524. // uni.setStorageSync("contract", data.contract);
  525. // uni.setStorageSync('showTran', data.showTran);
  526. // that.showTran = data.showTran
  527. // that.gridList[4].tips = data.task
  528. // that.gridList[2].tips = data.contract
  529. // that.companyId = data.companyId
  530. // uni.hideLoading()
  531. // })
  532. },
  533. confirm() {
  534. const that = this
  535. if (!that.inputContent) {
  536. that.$api.msg('输入不能为空')
  537. return
  538. }
  539. let obj = {}
  540. obj[that.feild] = that.inputContent
  541. that.$api.request('user', 'syncUserInfo', obj).then(res => {
  542. that.userInfo.nickname = that.inputContent
  543. that.inputContent = ''
  544. that.$store.commit('login', that.userInfo)
  545. })
  546. },
  547. cancel() {
  548. this.inputShow = false
  549. this.inputStatus = 'none'
  550. this.genderShow = false
  551. },
  552. myAccount() {
  553. uni.navigateTo({
  554. url: `/pageA/pages/contract`
  555. })
  556. },
  557. /**
  558. * 统一跳转接口,拦截未登录路由
  559. * navigator标签现在默认没有转场动画,所以用view
  560. */
  561. navTo(url) {
  562. if (!this.hasLogin) {
  563. url = '/pages/public/login';
  564. }
  565. uni.navigateTo({
  566. url
  567. })
  568. },
  569. mycarClick(carNo) {
  570. this.modalName = null
  571. uni.navigateTo({
  572. url: `/pageB/car/mycar_detail?carNo=${carNo}`
  573. })
  574. },
  575. scanCode() {
  576. uni.scanCode({
  577. success: function(res) {
  578. uni.navigateTo({
  579. url: res.result
  580. })
  581. }
  582. })
  583. },
  584. hideModal(e) {
  585. this.modalName = null
  586. },
  587. }
  588. }
  589. </script>
  590. <style lang='scss' scoped>
  591. page{
  592. background:#F5F6FA;
  593. }
  594. .title_b {
  595. margin: 20rpx 20rpx 0rpx 20rpx;
  596. padding: 20rpx 10rpx 20rpx 10rpx;
  597. font-size: 18px;
  598. font-weight: 550;
  599. }
  600. .c-row {
  601. display: -webkit-box;
  602. display: -webkit-flex;
  603. display: flex;
  604. -webkit-box-align: center;
  605. -webkit-align-items: center;
  606. align-items: center;
  607. padding: 20rpx 30rpx;
  608. position: relative;
  609. }
  610. .con-list {
  611. -webkit-box-flex: 1;
  612. -webkit-flex: 1;
  613. flex: 1;
  614. display: -webkit-box;
  615. display: -webkit-flex;
  616. display: flex;
  617. -webkit-box-orient: vertical;
  618. -webkit-box-direction: normal;
  619. -webkit-flex-direction: column;
  620. flex-direction: column;
  621. color: #303133;
  622. line-height: 40rpx;
  623. text-align: right;
  624. padding-right: 20rpx;
  625. }
  626. .wrap{
  627. padding-bottom:10px;
  628. font-size:14px;
  629. background:#fff;margin:10px;border-radius:10px;
  630. input{
  631. font-size:14px;
  632. }
  633. >.title{
  634. padding:10px 16px;
  635. }
  636. }
  637. .footer{
  638. background:#fff;
  639. position:fixed;
  640. bottom:0;
  641. width:100%;
  642. padding:20px 10px;
  643. z-index:10;
  644. .button{
  645. background:#22C572;
  646. width:90%;
  647. margin:0 auto;
  648. padding:10px;
  649. color:#fff;
  650. text-align:center;
  651. border-radius: 30px;
  652. }
  653. }
  654. </style>