add_quality_testing.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. <template>
  2. <view>
  3. <view @click='hidden' 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='show2=true'>{{gridList.goodsName}}</view>
  21. <u-picker :range="goodsList" range-key="goodsName" @confirm='goodspicker($event)' v-model="show2"
  22. mode="selector">
  23. </u-picker>
  24. </view>
  25. </view>
  26. <view class="c-row ">
  27. <view class="title">客户</view>
  28. <view class="con-list">
  29. <view @click='gocustomer' v-if='gridList.customerName'>
  30. {{gridList.customerName}}({{gridList.customerPhone}})
  31. </view>
  32. <view @click='gocustomer' v-else>
  33. 选择客户
  34. </view>
  35. </view>
  36. </view>
  37. <view class="c-row ">
  38. <view class="title">车牌号</view>
  39. <view class="con-list">
  40. <input v-model='gridList.carNumber' @click.stop="handleShowKeyboard":disabled="true" placeholder="请输入车牌号" name="input"></input>
  41. <master-keyboard ref="keyboard" keyboardtype="car" :randomNumber="true" :newCar="false" :defaultValue="gridList.carNumber" @keyboardClick="handleClick"></master-keyboard>
  42. </view>
  43. </view>
  44. <view v-if="gridList.paramType != '1'" class="c-row ">
  45. <view class="title">扣重比</view>
  46. <view class="con-list">
  47. <input v-model='gridList.buckleWeightRatio' placeholder="请输入扣重比" name="input" type="digit"></input>
  48. </view>
  49. </view>
  50. <view v-else class="c-row ">
  51. <view class="title">扣杂</view>
  52. <view class="con-list">
  53. <input v-model='gridList.buckleMiscellaneous' placeholder="初检扣杂" @input="waterContentChange"
  54. name="input" type="digit"></input>
  55. <input v-model='gridList.reBuckleMiscellaneous' placeholder="复检扣杂" @input="waterContentChange"
  56. name="input" type="digit"></input>
  57. </view>
  58. </view>
  59. <view class="c-row ">
  60. <view class="title">购粮性质</view>
  61. <view class="con-list">
  62. <input v-model='gridList.natureOfGrainPurchase' placeholder="请输入购粮性质" name="input"></input>
  63. </view>
  64. </view>
  65. <view class="c-row ">
  66. <view class="title">仓位号</view>
  67. <view class="con-list">
  68. <view @click='show=true'>{{gridList.binNumber?gridList.binNumber:'请选择仓位号'}}</view>
  69. <u-picker :range="warehouseList" range-key="binNumber" @confirm='binNumberpicker($event)'
  70. v-model="show" mode="selector">
  71. </u-picker>
  72. </view>
  73. </view>
  74. <view class="c-row ">
  75. <view class="title">囤位号</view>
  76. <view class="con-list">
  77. <input type="digit" v-model='gridList.storageTagNo' placeholder="请输入囤位号" name="input"></input>
  78. </view>
  79. </view>
  80. <view class="c-row ">
  81. <view class="title">类型</view>
  82. <view v-if="!edit" class="con-list">
  83. <view @click='show3=true'>{{gridList.type}}</view>
  84. <u-picker :range="typeList" @confirm='typepicker($event)' v-model="show3" mode="selector">
  85. </u-picker>
  86. </view>
  87. <view v-else class="con-list">{{gridList.type}}</view>
  88. </view>
  89. <view v-if="gridList.type == '潮粮'" class="c-row">
  90. <view class="title">净重单价(元/公斤)</view>
  91. <view class="con-list">
  92. <input v-model='gridList.tidalGrainPrice' disabled placeholder="自动获取,不可编辑" name="input"
  93. type="digit"></input>
  94. </view>
  95. </view>
  96. <view v-if="gridList.type == '干粮'" class="c-row">
  97. <view class="title">干粮单价(元/公斤)</view>
  98. <view class="con-list">
  99. <input v-model='gridList.dryGrainPrice' placeholder="请输入干粮单价" name="input" type="digit"></input>
  100. </view>
  101. </view>
  102. </view>
  103. <view style='padding-bottom:300rpx;'>
  104. <view class='wrap'>
  105. <view style='margin-right:10px;' class='flex justify-between align-item-center'>
  106. <view class='title_b'>化验信息</view>
  107. <view class='flex justify-between align-item-center'>补录:<u-switch activeColor="#22C572" v-model="value" @change="change"></u-switch></view>
  108. </view>
  109. <view class="c-row ">
  110. <view class="title">等级</view>
  111. <view class="con-list">
  112. <view @click='show1=true'>{{gridList.grade?gridList.grade:'请选择等级'}}</view>
  113. <u-picker :range="gradeList" range-key="value" @confirm='gradepicker($event)' v-model="show1"
  114. mode="selector">
  115. </u-picker>
  116. </view>
  117. </view>
  118. <view class="c-row ">
  119. <view class="title">水分(%)</view>
  120. <view class="con-list">
  121. <input v-model='gridList.waterContent' placeholder="初检水分" @input="waterContentChange"
  122. name="input" type="digit"></input>
  123. <input v-model='gridList.rewaterContent' placeholder="复检水分" @input="waterContentChange"
  124. name="input" type="digit"></input>
  125. </view>
  126. </view>
  127. <view class="c-row ">
  128. <view class="title">容重(克/升)</view>
  129. <view class="con-list">
  130. <input v-model='gridList.bulkDensity' placeholder="请输入容重" name="input" type="digit"></input>
  131. </view>
  132. </view>
  133. <view class="c-row ">
  134. <view class="title">不完善粒(%)</view>
  135. <view class="con-list">
  136. <input v-model='gridList.imperfectGrain' placeholder="请输入不完整粒占比" name="input"
  137. type="digit"></input>
  138. </view>
  139. </view>
  140. <view class="c-row ">
  141. <view class="title">杂质(%)</view>
  142. <view class="con-list">
  143. <input v-model='gridList.impurity' placeholder="请输入杂质占比" name="input" type="digit"></input>
  144. </view>
  145. </view>
  146. <view class="c-row ">
  147. <view class="title">霉变粒(%)</view>
  148. <view class="con-list">
  149. <input v-model='gridList.mildewGrain' placeholder="请输入霉变粒占比" name="input" type="digit"></input>
  150. </view>
  151. </view>
  152. <view class="c-row">
  153. <view class="title">热损伤(%)</view>
  154. <view class="con-list">
  155. <input v-model='gridList.jiaorenli' placeholder="请输入热损伤占比" name="input" type="digit"></input>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. <view class="footer">
  161. <!-- <view @click='confirmInfo' class="button">确认初检信息</view> -->
  162. <view @click='submit' class="button">提交</view>
  163. </view>
  164. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  165. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
  166. showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  167. <u-popup v-model="isShowPrint" class="popup" @close="close" mode="bottom" border-radius="30" :closeable="true">
  168. <view class="buns_item">
  169. <view class="but_css" @click="print">打印小票</view>
  170. <view class="but_css" @click="close">返回</view>
  171. </view>
  172. </u-popup>
  173. </view>
  174. </template>
  175. <script>
  176. import dragButton from "@/components/drag-button/drag-button.vue";
  177. import keyboard from "@/components/master-keyboard/master-keyboard.vue";
  178. import {
  179. mapState
  180. } from 'vuex';
  181. let startY = 0,
  182. moveY = 0,
  183. pageAtTop = true;
  184. export default {
  185. components: {
  186. dragButton,
  187. keyboard
  188. },
  189. data() {
  190. return {
  191. isShowPrint:false,
  192. isShowAlert: false,
  193. content: '确认初检信息后,初检员不需要再次确认质检信息,是否确定提交?',
  194. inputShow: false,
  195. modalName: '',
  196. mycarStyle: '',
  197. feild: undefined,
  198. id: 0,
  199. show: false,
  200. edit: true,
  201. selector: [],
  202. show1: false,
  203. inputContent: '',
  204. coverTransform: 'translateY(0px)',
  205. coverTransition: '0s',
  206. moving: false,
  207. footprintList: [],
  208. searchKeyWord: '',
  209. isVip: false,
  210. userInfoTmp: [],
  211. inputStatus: 'none',
  212. carInfo: [],
  213. gridCol: 4,
  214. pageSize: 10,
  215. show3: false,
  216. show2: false,
  217. goodsList: [],
  218. currentPage: 1,
  219. value:false,
  220. gridBorder: false,
  221. headUrl: "../../static/img/myimg/YongHu@3x.png",
  222. userphone: "",
  223. username: "请更改昵称",
  224. gridList: {
  225. natureOfGrainPurchase: '贸易粮',
  226. type: '',
  227. tidalGrainPrice: '',
  228. dryGrainPrice: '',
  229. buckleMiscellaneous: '',
  230. carNumber:'',
  231. customerName:'',
  232. customerPhone:'',
  233. bulkDensity:"",
  234. imperfectGrain:"",
  235. waterContent:"",
  236. jiaorenli:"",
  237. impurity:"",
  238. mildewGrain:"",
  239. compName:"",
  240. },
  241. typeList: ['潮粮', '干粮'],
  242. managementType: '',
  243. warehouseName: '',
  244. warehouseList: [],
  245. warehouseCount: '',
  246. commonWarehouseNo: '',
  247. showTran: true,
  248. companyId: 1,
  249. current: 4,
  250. gradeList: [{
  251. key: 1,
  252. value: '一等品'
  253. },
  254. {
  255. key: 2,
  256. value: '二等品'
  257. },
  258. {
  259. key: 3,
  260. value: '三等品'
  261. },
  262. {
  263. key: 4,
  264. value: '等外'
  265. },
  266. ],
  267. cangid: ''
  268. }
  269. },
  270. // #ifndef MP
  271. onNavigationBarButtonTap(e) {
  272. const index = e.index;
  273. if (index === 0) {
  274. this.navTo('/pages/set/set');
  275. } else if (index === 1) {
  276. // #ifdef APP-PLUS
  277. const pages = getCurrentPages();
  278. const page = pages[pages.length - 1];
  279. const currentWebview = page.$getAppWebview();
  280. currentWebview.hideTitleNViewButtonRedDot({
  281. index
  282. });
  283. // #endif
  284. uni.navigateTo({
  285. url: '/pages/notice/notice'
  286. })
  287. }
  288. },
  289. // #endif
  290. computed: {
  291. ...mapState(['hasLogin', 'userInfo']),
  292. // 手机号中间4位加*
  293. starUserphone() {
  294. let reg = /^(\d{3})\d{4}(\d{4})$/;
  295. if (this.userphone) {
  296. return this.userphone.replace(reg, "$1****$2");
  297. }
  298. }
  299. },
  300. onLoad(options) {
  301. this.commonWarehouseNo = options.commonWarehouseNo
  302. this.warehouseCount = Number(options.warehouseCount) + 1
  303. let number = '000' + this.warehouseCount
  304. number = number.substring(number.length - 4, number.length)
  305. this.gridList.warehouseName = options.warehouseName
  306. this.gridList.qualityNo = 'SGRK' + this.getdate() + this.commonWarehouseNo + number
  307. this.cangid = options.cangid
  308. this.gridList.compName = uni.getStorageSync('compName')
  309. this.gridList.person= options.personCharge
  310. this.gridList.personPhone= options.personPhone
  311. this.gridList.qualityInspector= uni.getStorageSync("userInfo").userName
  312. // this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
  313. // warehouseId: this.cangid
  314. // }).then(res => {
  315. // if (res.data.data) {
  316. // this.setGoodName([0])
  317. // }
  318. // })
  319. this.managementType = options.managementType
  320. let that = this
  321. this.purchasePriceList = uni.getStorageSync('purchasePriceList')
  322. // if (uni.getStorageSync('checkcustomer')) {
  323. // let _customerInfo = uni.getStorageSync('checkcustomer')
  324. // if (_customerInfo.shipperName) {
  325. // this.gridList.identityId = _customerInfo.id
  326. // //点击登记客户
  327. // this.gridList.customerName = _customerInfo.shipperName
  328. // this.gridList.customerPhone = _customerInfo.shipperPhone
  329. // this.gridList.carNumber=_customerInfo.carNo
  330. // } else {
  331. // //点击搜索客户
  332. // this.gridList.customerName = _customerInfo.customerName
  333. // this.gridList.customerPhone = _customerInfo.customerPhone
  334. // }
  335. // this.gridList.customerNumberCard = _customerInfo.customerNumberCard
  336. // }
  337. this.gridList.grade = this.gradeList[0].value
  338. this.gridList.gradeKey = this.gradeList[0].key
  339. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  340. id: this.cangid
  341. }).then(res => {
  342. this.warehouseList = res.data.data.warehousePositionInfoList
  343. })
  344. this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
  345. warehouseId: this.cangid
  346. }).then(res => {
  347. if (res.data.data) {
  348. that.goodsList = res.data.data
  349. if (that.goodsList.length > 0) {
  350. that.gridList.goodsName = that.goodsList[0].goodsName
  351. this.setGoodName([0])
  352. uni.setStorageSync('purchasePriceList', that.goodsList)
  353. that.purchasePriceList = uni.getStorageSync('purchasePriceList')
  354. }
  355. // for (let i = 0; i < res.data.data.length; i++) {
  356. // this.goodsList.push(res.data.data[i].goodsName)
  357. // }
  358. // if(this.goodsList.some(item=>{return item.goodsName=='玉米'})){
  359. // this.gridList.goodsName='玉米'
  360. // uni.setStorageSync('goodsName',this.gridList.goodsName)
  361. // }else{
  362. // this.gridList.goodsName=this.goodsList[0].goodsName
  363. // uni.setStorageSync('goodsName',this.gridList.goodsName)
  364. // }
  365. }
  366. })
  367. },
  368. onShow(){
  369. if (uni.getStorageSync('checkcustomer')) {
  370. let _customerInfo = uni.getStorageSync('checkcustomer')
  371. if (_customerInfo.shipperName) {
  372. this.gridList.identityId = _customerInfo.id
  373. //点击登记客户
  374. this.gridList.customerName = _customerInfo.shipperName
  375. this.gridList.customerPhone = _customerInfo.shipperPhone
  376. this.gridList.carNumber=_customerInfo.carNo
  377. } else {
  378. //点击搜索客户
  379. this.gridList.customerName = _customerInfo.customerName
  380. this.gridList.customerPhone = _customerInfo.customerPhone
  381. }
  382. this.gridList.customerNumberCard = _customerInfo.customerNumberCard
  383. }
  384. },
  385. methods: {
  386. change(e){
  387. if(e){
  388. this.gridList.supplementaryRecording=1
  389. }else{
  390. this.gridList.supplementaryRecording=0
  391. }
  392. },
  393. print(){
  394. uni.navigateTo({
  395. url: '/pages/erpbusiness/bleConnect'
  396. })
  397. },
  398. close(){
  399. this.isShowPrint = false
  400. uni.navigateBack({})
  401. },
  402. hidden(){
  403. this.$refs.keyboard.open(false)
  404. },
  405. handleShowKeyboard(){
  406. if(this.$refs.keyboard.open){
  407. this.$refs.keyboard.open(true)//true 键盘显示 false 键盘隐藏
  408. }else{
  409. this.$refs.keyboard[0].open(true)
  410. }
  411. },
  412. handleClick(e){
  413. this.gridList.carNumber = e.value //键盘输入值
  414. },
  415. // confirmInfo() {
  416. // this.isShowAlert = true
  417. // },
  418. // alertBtn() {
  419. // this.$api.doRequest('get', '/qualityInspectionManagement/api/editQualityInspection', {
  420. // id: this.id,
  421. // flag:2
  422. // }).then(res => {
  423. // if(res.data.code=="200"){
  424. // this.$api.msg('提交成功!')
  425. // }else{
  426. // this.$api.msg('提交失败')
  427. // }
  428. // })
  429. // },
  430. cancelClick() {
  431. this.isShowAlert = false
  432. },
  433. waterContentChange() {
  434. var that = this
  435. if (this.gridList.goodsName && this.cangid) {
  436. if (!this.gridList.dryGrainPrice || this.gridList.dryGrainPrice == 0) {
  437. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice', {
  438. warehouseId: this.cangid,
  439. goodsName: this.gridList.goodsName
  440. }).then(res => {
  441. that.gridList.dryGrainPrice = res.data.data
  442. })
  443. }
  444. }
  445. if (this.gridList.goodsName) {
  446. for (var i = 0; i < this.purchasePriceList.length; i++) {
  447. if (this.purchasePriceList[i].goodsName == this.gridList.goodsName) {
  448. this.gridList.buckleWeightRatio = this.purchasePriceList[i].deductWeight
  449. this.gridList.paramType = this.purchasePriceList[i].paramType
  450. }
  451. }
  452. }
  453. var numReg = /^[0-9]*$/
  454. var numRe = new RegExp(numReg)
  455. //潮粮单价改变事件
  456. if (
  457. this.gridList.goodsName &&
  458. this.gridList.waterContent &&
  459. this.gridList.grade &&
  460. numRe.test(this.gridList.waterContent)
  461. ) {
  462. this.$api.doRequest('get', '/purchasePrice/tidalGrainPrice', {
  463. warehouseId: this.cangid,
  464. goodsName: this.gridList.goodsName,
  465. waterContent: this.gridList.waterContent,
  466. grade: this.gridList.grade,
  467. }).then(res => {
  468. if (that.gridList.paramType == '1') {
  469. that.gridList.tidalGrainPrice = parseFloat(parseFloat(res.data.data) - parseFloat(that
  470. .gridList.buckleMiscellaneous) / 100 * parseFloat(that.gridList
  471. .dryGrainPrice)).toFixed(4)
  472. if (!that.gridList.tidalGrainPrice) {
  473. that.gridList.tidalGrainPrice = ''
  474. }
  475. } else {
  476. if(that.gridList.type == '干粮'){
  477. that.gridList.dryGrainPrice = res.data.data
  478. }
  479. else{
  480. that.gridList.tidalGrainPrice = res.data.data
  481. }
  482. }
  483. })
  484. }
  485. },
  486. gocustomer() {
  487. uni.navigateTo({
  488. url: '/pages/erpbusiness/customer?cangid=' + this.cangid + '&warehouseName=' + this.gridList.warehouseName + '&goodsName=' + this.gridList.goodsName
  489. })
  490. },
  491. getdate() {
  492. var date = new Date()
  493. var year = date.getFullYear() //获取完整的年份(4位)
  494. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  495. var datetime = date.getDate() //获取当前日(1-31)
  496. if (mouth < 10) {
  497. mouth = '0' + mouth
  498. }
  499. if (datetime < 10) {
  500. datetime = '0' + datetime
  501. }
  502. return year + '' + mouth + '' + datetime
  503. },
  504. submit() {
  505. var that = this
  506. if (!this.gridList.qualityNo) {
  507. this.$api.msg('编号不能为空')
  508. return
  509. }
  510. if (!this.gridList.binNumber) {
  511. this.$api.msg('仓位不能为空')
  512. return
  513. }
  514. if (!this.gridList.customerName) {
  515. this.$api.msg('客户不能为空')
  516. return
  517. }
  518. if (!this.gridList.storageTagNo) {
  519. this.$api.msg('囤位号不能为空')
  520. return
  521. }
  522. if (this.gridList.storageTagNo.length > 10) {
  523. this.$api.msg('囤位号不能为空')
  524. return
  525. }
  526. if (!this.gridList.carNumber) {
  527. this.$api.msg('车牌号不能为空')
  528. return
  529. }
  530. if (this.gridList.carNumber.length != 7) {
  531. this.$api.msg('车牌号输入错误')
  532. return
  533. }
  534. if (!this.gridList.goodsName) {
  535. this.$api.msg('货名不能为空')
  536. return
  537. }
  538. if (this.gridList.buckleWeightRatio < 0 || this.gridList.buckleWeightRatio > 2) {
  539. this.$api.msg('扣重比输入错误')
  540. return
  541. }
  542. if (
  543. String(this.gridList.buckleWeightRatio).indexOf('.') != -1 &&
  544. String(this.gridList.buckleWeightRatio).length -
  545. (String(this.gridList.buckleWeightRatio).indexOf('.') + 1) > 2) {
  546. this.$api.msg('扣重比输入错误')
  547. return
  548. }
  549. if (!this.gridList.type) {
  550. this.$api.msg('类型不能为空')
  551. return
  552. }
  553. if (!this.gridList.natureOfGrainPurchase) {
  554. this.$api.msg('购粮性质不能为空')
  555. return
  556. }
  557. if(this.value==false){
  558. if (!this.gridList.grade) {
  559. this.$api.msg('等级不能为空')
  560. return
  561. }
  562. if (!this.gridList.impurity) {
  563. this.$api.msg('杂质不能为空')
  564. return
  565. }
  566. if (!this.gridList.waterContent) {
  567. this.$api.msg('初检水分不能为空')
  568. return
  569. }
  570. // if (!this.gridList.reWaterContent) {
  571. // this.$api.msg('复检水分不能为空')
  572. // return
  573. // }
  574. if (!this.gridList.mildewGrain) {
  575. this.$api.msg('霉变粒不能为空')
  576. return
  577. }
  578. if (!this.gridList.bulkDensity) {
  579. this.$api.msg('容重不能为空')
  580. return
  581. }
  582. if (!this.gridList.jiaorenli) {
  583. this.$api.msg('热损伤不能为空')
  584. return
  585. }
  586. if (!this.gridList.imperfectGrain) {
  587. this.$api.msg('不完整粒不能为空')
  588. return
  589. }
  590. }
  591. uni.showModal({
  592. content: "确定提交质检信息?",
  593. showCancel: true,
  594. confirmText: '提交',
  595. success: function(res) {
  596. if (res.confirm) {
  597. that.$api.doRequest('get', '/paymentManagement/cumulant', {
  598. compId: uni.getStorageSync('pcUserInfo').compId,
  599. customerNumberCard: that.gridList.customerNumberCard,
  600. goodsName: that.gridList.goodsName,
  601. })
  602. .then(response => {
  603. if (response.data.code == 200) {
  604. for (let i = 0; i < that.purchasePriceList.length; i++) {
  605. if (
  606. that.gridList.goodsName == that.purchasePriceList[i]
  607. .goodsName
  608. ) {
  609. let count = (that.purchasePriceList[i].saleLimit -
  610. response.data.data / 1000).toFixed(2)
  611. console.log(count,that.purchasePriceList[i].saleLimit,
  612. response.data.data)
  613. if (Number(count) <= 0) {
  614. count = 0
  615. that.$api.msg('该客户累计销售' + that.gridList.goodsName + (
  616. response.data.data / 1000).toFixed(2) +
  617. '吨,还可售粮' +
  618. count + '吨', )
  619. } else {
  620. that.$api.doRequest('post',
  621. '/qualityInspectionManagement/api/addQualityInspection',
  622. that.gridList)
  623. .then(res => {
  624. if (res.data.code == 200) {
  625. that.$api.msg('提交成功')
  626. that.isShowPrint = true
  627. that.gridList.warehouseId = that.cangid
  628. that.gridList.compId = uni.getStorageSync('pcUserInfo').compId
  629. uni.setStorageSync("quality_print",that.gridList)
  630. console.log('that.gridList',that.gridList)
  631. // uni.navigateBack({})
  632. } else {
  633. hat.$api.msg('提交失败')
  634. }
  635. })
  636. }
  637. }
  638. }
  639. }
  640. })
  641. }
  642. }
  643. })
  644. },
  645. gradepicker(e) {
  646. console.log(e)
  647. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  648. this.gridList.grade = this.gradeList[e[0]].value
  649. this.gridList.gradeKey = this.gradeList[e[0]].key
  650. this.waterContentChange()
  651. },
  652. setGoodName(e) {
  653. //
  654. // [e[0]] = 0
  655. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  656. if (this.goodsList[e[0]].goodsName == '玉米') {
  657. this.gridList.type = '干粮'
  658. this.edit = true
  659. } else if (this.goodsList[e[0]].goodsName == '玉米(潮粮)') {
  660. this.gridList.type = '潮粮'
  661. this.edit = true
  662. } else {
  663. this.gridList.type = '干粮'
  664. this.edit = false
  665. }
  666. var that = this
  667. this.gridList.goodsName = this.goodsList[e[0]].goodsName
  668. // this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer', {
  669. // warehouseId: this.cangid,
  670. // goodsName: this.gridList.goodsName
  671. // }).then(res => {
  672. // if (res.data.data) {
  673. // uni.hideLoading()
  674. // // let data = res.data.data
  675. // // that.gridList =data
  676. // }
  677. // })
  678. uni.setStorageSync('goodsName', this.gridList.goodsName)
  679. if (this.gridList.type == "干粮" && this.gridList.goodsName) {
  680. uni.showLoading({title: '加载中',mask:true})
  681. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice', {
  682. warehouseId: this.cangid,
  683. goodsName: this.gridList.goodsName
  684. }).then(res => {
  685. this.gridList.dryGrainPrice = res.data.data
  686. uni.hideLoading()
  687. })
  688. }
  689. this.waterContentChange()
  690. },
  691. goodspicker(e) {
  692. console.log(e)
  693. this.setGoodName(e)
  694. },
  695. typepicker(e) {
  696. var that = this
  697. this.gridList.type = this.typeList[e[0]]
  698. if (this.gridList.type == "干粮" && this.gridList.goodsName) {
  699. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice', {
  700. warehouseId: this.cangid,
  701. goodsName: this.gridList.goodsName
  702. }).then(res => {
  703. that.gridList.dryGrainPrice = res.data.data
  704. })
  705. }
  706. },
  707. binNumberpicker(e) {
  708. this.gridList.binNumber = this.warehouseList[e[0]].binNumber
  709. },
  710. del(item) {
  711. this.$api.doRequest('get', '/qualityInspectionManagement/api/deleteQualityInspection', {
  712. id: item.id
  713. }).then(res => {
  714. if (res.data.code == 200) {
  715. this.$api.msg('删除成功')
  716. } else {
  717. this.$api.msg('系统异常,请联系管理员')
  718. }
  719. })
  720. },
  721. contactUs() {
  722. const that = this
  723. uni.makePhoneCall({
  724. // 手机号
  725. phoneNumber: '18241771147',
  726. // 成功回调
  727. success: (res) => {},
  728. // 失败回调
  729. fail: (res) => {}
  730. });
  731. },
  732. loadData() {
  733. // const that = this
  734. // if(uni.getStorageSync("PageCur")){
  735. // that.PageCur = uni.getStorageSync("PageCur");
  736. // }
  737. // that.userInfoTmp = uni.getStorageSync("userInfo")
  738. // uni.showLoading({
  739. // title: '正在加载',
  740. // mask:true
  741. // })
  742. // that.$api.request('integral', 'getIndexData', failres => {
  743. // that.$api.msg(failres.errmsg)
  744. // uni.hideLoading()
  745. // }).then(res => {
  746. // let data = res.data
  747. // uni.setStorageSync("message", data.message);
  748. // uni.setStorageSync("task", data.task);
  749. // uni.setStorageSync("contract", data.contract);
  750. // uni.setStorageSync('showTran', data.showTran);
  751. // that.showTran = data.showTran
  752. // that.gridList[4].tips = data.task
  753. // that.gridList[2].tips = data.contract
  754. // that.companyId = data.companyId
  755. // uni.hideLoading()
  756. // })
  757. },
  758. confirm() {
  759. const that = this
  760. if (!that.inputContent) {
  761. that.$api.msg('输入不能为空')
  762. return
  763. }
  764. let obj = {}
  765. obj[that.feild] = that.inputContent
  766. that.$api.request('user', 'syncUserInfo', obj).then(res => {
  767. that.userInfo.nickname = that.inputContent
  768. that.inputContent = ''
  769. that.$store.commit('login', that.userInfo)
  770. })
  771. },
  772. cancel() {
  773. this.inputShow = false
  774. this.inputStatus = 'none'
  775. this.genderShow = false
  776. },
  777. myAccount() {
  778. uni.navigateTo({
  779. url: `/pageA/pages/contract`
  780. })
  781. },
  782. /**
  783. * 统一跳转接口,拦截未登录路由
  784. * navigator标签现在默认没有转场动画,所以用view
  785. */
  786. navTo(url) {
  787. if (!this.hasLogin) {
  788. url = '/pages/public/login';
  789. }
  790. uni.navigateTo({
  791. url
  792. })
  793. },
  794. mycarClick(carNo) {
  795. this.modalName = null
  796. uni.navigateTo({
  797. url: `/pageB/car/mycar_detail?carNo=${carNo}`
  798. })
  799. },
  800. scanCode() {
  801. uni.scanCode({
  802. success: function(res) {
  803. uni.navigateTo({
  804. url: res.result
  805. })
  806. }
  807. })
  808. },
  809. hideModal(e) {
  810. this.modalName = null
  811. },
  812. }
  813. }
  814. </script>
  815. <style lang='scss' scoped>
  816. page {
  817. background: #F5F6FA;
  818. }
  819. .title_b {
  820. margin: 20rpx 20rpx 0rpx 20rpx;
  821. padding: 20rpx 10rpx 20rpx 10rpx;
  822. font-size: 18px;
  823. font-weight: 550;
  824. }
  825. .c-row {
  826. display: -webkit-box;
  827. display: -webkit-flex;
  828. display: flex;
  829. -webkit-box-align: center;
  830. -webkit-align-items: center;
  831. align-items: center;
  832. padding: 20rpx 30rpx;
  833. position: relative;
  834. }
  835. .con-list {
  836. -webkit-box-flex: 1;
  837. -webkit-flex: 1;
  838. flex: 1;
  839. display: -webkit-box;
  840. display: -webkit-flex;
  841. display: flex;
  842. -webkit-box-orient: vertical;
  843. -webkit-box-direction: normal;
  844. -webkit-flex-direction: column;
  845. flex-direction: column;
  846. color: #303133;
  847. line-height: 40rpx;
  848. text-align: right;
  849. padding-right: 20rpx;
  850. }
  851. .wrap {
  852. padding-bottom: 10px;
  853. font-size: 14px;
  854. background: #fff;
  855. margin: 10px;
  856. border-radius: 10px;
  857. input {
  858. font-size: 14px;
  859. }
  860. >.title {
  861. padding: 10px 16px;
  862. }
  863. }
  864. .footer {
  865. background: #fff;
  866. position: fixed;
  867. bottom: 0;
  868. width: 100%;
  869. padding: 20px 10px;
  870. z-index: 10;
  871. .button {
  872. background: #22C572;
  873. width: 90%;
  874. margin: 20rpx auto;
  875. padding: 10px;
  876. color: #fff;
  877. text-align: center;
  878. border-radius: 30px;
  879. }
  880. }
  881. .buns_item{
  882. display: flex;
  883. padding: 80rpx 0 50rpx 0;
  884. justify-content: space-around;
  885. }
  886. .but_css{
  887. background: #22C572;
  888. width: 40%;
  889. padding: 20rpx;
  890. color: #fff;
  891. text-align: center;
  892. border-radius: 20rpx;
  893. }
  894. </style>