add_quality_testing.vue 16 KB

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