add_quality_testing.vue 14 KB

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