add_quality_testing.vue 16 KB

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