add_quality_testing.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  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. that.gridList.tidalGrainPrice = res.data.data
  477. }
  478. })
  479. }
  480. },
  481. gocustomer() {
  482. uni.navigateTo({
  483. url: '/pages/erpbusiness/customer?cangid=' + this.cangid + '&warehouseName=' + this.gridList.warehouseName + '&goodsName=' + this.gridList.goodsName
  484. })
  485. },
  486. getdate() {
  487. var date = new Date()
  488. var year = date.getFullYear() //获取完整的年份(4位)
  489. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  490. var datetime = date.getDate() //获取当前日(1-31)
  491. if (mouth < 10) {
  492. mouth = '0' + mouth
  493. }
  494. if (datetime < 10) {
  495. datetime = '0' + datetime
  496. }
  497. return year + '' + mouth + '' + datetime
  498. },
  499. submit() {
  500. var that = this
  501. if (!this.gridList.qualityNo) {
  502. this.$api.msg('编号不能为空')
  503. return
  504. }
  505. if (!this.gridList.binNumber) {
  506. this.$api.msg('仓位不能为空')
  507. return
  508. }
  509. if (!this.gridList.customerName) {
  510. this.$api.msg('客户不能为空')
  511. return
  512. }
  513. if (!this.gridList.storageTagNo) {
  514. this.$api.msg('囤位号不能为空')
  515. return
  516. }
  517. if (this.gridList.storageTagNo.length > 10) {
  518. this.$api.msg('囤位号不能为空')
  519. return
  520. }
  521. if (!this.gridList.carNumber) {
  522. this.$api.msg('车牌号不能为空')
  523. return
  524. }
  525. if (this.gridList.carNumber.length != 7) {
  526. this.$api.msg('车牌号输入错误')
  527. return
  528. }
  529. if (!this.gridList.goodsName) {
  530. this.$api.msg('货名不能为空')
  531. return
  532. }
  533. if (this.gridList.buckleWeightRatio < 0 || this.gridList.buckleWeightRatio > 2) {
  534. this.$api.msg('扣重比输入错误')
  535. return
  536. }
  537. if (
  538. String(this.gridList.buckleWeightRatio).indexOf('.') != -1 &&
  539. String(this.gridList.buckleWeightRatio).length -
  540. (String(this.gridList.buckleWeightRatio).indexOf('.') + 1) > 2) {
  541. this.$api.msg('扣重比输入错误')
  542. return
  543. }
  544. if (!this.gridList.type) {
  545. this.$api.msg('类型不能为空')
  546. return
  547. }
  548. if (!this.gridList.natureOfGrainPurchase) {
  549. this.$api.msg('购粮性质不能为空')
  550. return
  551. }
  552. if(this.value==false){
  553. if (!this.gridList.grade) {
  554. this.$api.msg('等级不能为空')
  555. return
  556. }
  557. if (!this.gridList.impurity) {
  558. this.$api.msg('杂质不能为空')
  559. return
  560. }
  561. if (!this.gridList.waterContent) {
  562. this.$api.msg('初检水分不能为空')
  563. return
  564. }
  565. // if (!this.gridList.reWaterContent) {
  566. // this.$api.msg('复检水分不能为空')
  567. // return
  568. // }
  569. if (!this.gridList.mildewGrain) {
  570. this.$api.msg('霉变粒不能为空')
  571. return
  572. }
  573. if (!this.gridList.bulkDensity) {
  574. this.$api.msg('容重不能为空')
  575. return
  576. }
  577. if (!this.gridList.jiaorenli) {
  578. this.$api.msg('热损伤不能为空')
  579. return
  580. }
  581. if (!this.gridList.imperfectGrain) {
  582. this.$api.msg('不完整粒不能为空')
  583. return
  584. }
  585. }
  586. uni.showModal({
  587. content: "确定提交质检信息?",
  588. showCancel: true,
  589. confirmText: '提交',
  590. success: function(res) {
  591. if (res.confirm) {
  592. that.$api.doRequest('get', '/paymentManagement/cumulant', {
  593. compId: uni.getStorageSync('pcUserInfo').compId,
  594. customerNumberCard: that.gridList.customerNumberCard,
  595. goodsName: that.gridList.goodsName,
  596. })
  597. .then(response => {
  598. if (response.data.code == 200) {
  599. for (let i = 0; i < that.purchasePriceList.length; i++) {
  600. if (
  601. that.gridList.goodsName == that.purchasePriceList[i]
  602. .goodsName
  603. ) {
  604. let count = (that.purchasePriceList[i].saleLimit -
  605. response.data.data / 1000).toFixed(2)
  606. console.log(count,that.purchasePriceList[i].saleLimit,
  607. response.data.data)
  608. if (Number(count) <= 0) {
  609. count = 0
  610. that.$api.msg('该客户累计销售' + that.gridList.goodsName + (
  611. response.data.data / 1000).toFixed(2) +
  612. '吨,还可售粮' +
  613. count + '吨', )
  614. } else {
  615. that.$api.doRequest('post',
  616. '/qualityInspectionManagement/api/addQualityInspection',
  617. that.gridList)
  618. .then(res => {
  619. if (res.data.code == 200) {
  620. that.$api.msg('提交成功')
  621. that.isShowPrint = true
  622. that.gridList.warehouseId = that.cangid
  623. that.gridList.compId = uni.getStorageSync('pcUserInfo').compId
  624. uni.setStorageSync("quality_print",that.gridList)
  625. console.log('that.gridList',that.gridList)
  626. // uni.navigateBack({})
  627. } else {
  628. hat.$api.msg('提交失败')
  629. }
  630. })
  631. }
  632. }
  633. }
  634. }
  635. })
  636. }
  637. }
  638. })
  639. },
  640. gradepicker(e) {
  641. console.log(e)
  642. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  643. this.gridList.grade = this.gradeList[e[0]].value
  644. this.gridList.gradeKey = this.gradeList[e[0]].key
  645. this.waterContentChange()
  646. },
  647. setGoodName(e) {
  648. //
  649. // [e[0]] = 0
  650. // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
  651. if (this.goodsList[e[0]].goodsName == '玉米') {
  652. this.gridList.type = '干粮'
  653. this.edit = true
  654. } else if (this.goodsList[e[0]].goodsName == '玉米(潮粮)') {
  655. this.gridList.type = '潮粮'
  656. this.edit = true
  657. } else {
  658. this.gridList.type = '干粮'
  659. this.edit = false
  660. }
  661. var that = this
  662. this.gridList.goodsName = this.goodsList[e[0]].goodsName
  663. // this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer', {
  664. // warehouseId: this.cangid,
  665. // goodsName: this.gridList.goodsName
  666. // }).then(res => {
  667. // if (res.data.data) {
  668. // uni.hideLoading()
  669. // // let data = res.data.data
  670. // // that.gridList =data
  671. // }
  672. // })
  673. uni.setStorageSync('goodsName', this.gridList.goodsName)
  674. if (this.gridList.type == "干粮" && this.gridList.goodsName) {
  675. uni.showLoading({title: '加载中',mask:true})
  676. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice', {
  677. warehouseId: this.cangid,
  678. goodsName: this.gridList.goodsName
  679. }).then(res => {
  680. this.gridList.dryGrainPrice = res.data.data
  681. uni.hideLoading()
  682. })
  683. }
  684. this.waterContentChange()
  685. },
  686. goodspicker(e) {
  687. console.log(e)
  688. this.setGoodName(e)
  689. },
  690. typepicker(e) {
  691. var that = this
  692. this.gridList.type = this.typeList[e[0]]
  693. if (this.gridList.type == "干粮" && this.gridList.goodsName) {
  694. this.$api.doRequest('get', '/purchasePrice/dryGrainPrice', {
  695. warehouseId: this.cangid,
  696. goodsName: this.gridList.goodsName
  697. }).then(res => {
  698. that.gridList.dryGrainPrice = res.data.data
  699. })
  700. }
  701. },
  702. binNumberpicker(e) {
  703. this.gridList.binNumber = this.warehouseList[e[0]].binNumber
  704. },
  705. del(item) {
  706. this.$api.doRequest('get', '/qualityInspectionManagement/api/deleteQualityInspection', {
  707. id: item.id
  708. }).then(res => {
  709. if (res.data.code == 200) {
  710. this.$api.msg('删除成功')
  711. } else {
  712. this.$api.msg('系统异常,请联系管理员')
  713. }
  714. })
  715. },
  716. contactUs() {
  717. const that = this
  718. uni.makePhoneCall({
  719. // 手机号
  720. phoneNumber: '18241771147',
  721. // 成功回调
  722. success: (res) => {},
  723. // 失败回调
  724. fail: (res) => {}
  725. });
  726. },
  727. loadData() {
  728. // const that = this
  729. // if(uni.getStorageSync("PageCur")){
  730. // that.PageCur = uni.getStorageSync("PageCur");
  731. // }
  732. // that.userInfoTmp = uni.getStorageSync("userInfo")
  733. // uni.showLoading({
  734. // title: '正在加载',
  735. // mask:true
  736. // })
  737. // that.$api.request('integral', 'getIndexData', failres => {
  738. // that.$api.msg(failres.errmsg)
  739. // uni.hideLoading()
  740. // }).then(res => {
  741. // let data = res.data
  742. // uni.setStorageSync("message", data.message);
  743. // uni.setStorageSync("task", data.task);
  744. // uni.setStorageSync("contract", data.contract);
  745. // uni.setStorageSync('showTran', data.showTran);
  746. // that.showTran = data.showTran
  747. // that.gridList[4].tips = data.task
  748. // that.gridList[2].tips = data.contract
  749. // that.companyId = data.companyId
  750. // uni.hideLoading()
  751. // })
  752. },
  753. confirm() {
  754. const that = this
  755. if (!that.inputContent) {
  756. that.$api.msg('输入不能为空')
  757. return
  758. }
  759. let obj = {}
  760. obj[that.feild] = that.inputContent
  761. that.$api.request('user', 'syncUserInfo', obj).then(res => {
  762. that.userInfo.nickname = that.inputContent
  763. that.inputContent = ''
  764. that.$store.commit('login', that.userInfo)
  765. })
  766. },
  767. cancel() {
  768. this.inputShow = false
  769. this.inputStatus = 'none'
  770. this.genderShow = false
  771. },
  772. myAccount() {
  773. uni.navigateTo({
  774. url: `/pageA/pages/contract`
  775. })
  776. },
  777. /**
  778. * 统一跳转接口,拦截未登录路由
  779. * navigator标签现在默认没有转场动画,所以用view
  780. */
  781. navTo(url) {
  782. if (!this.hasLogin) {
  783. url = '/pages/public/login';
  784. }
  785. uni.navigateTo({
  786. url
  787. })
  788. },
  789. mycarClick(carNo) {
  790. this.modalName = null
  791. uni.navigateTo({
  792. url: `/pageB/car/mycar_detail?carNo=${carNo}`
  793. })
  794. },
  795. scanCode() {
  796. uni.scanCode({
  797. success: function(res) {
  798. uni.navigateTo({
  799. url: res.result
  800. })
  801. }
  802. })
  803. },
  804. hideModal(e) {
  805. this.modalName = null
  806. },
  807. }
  808. }
  809. </script>
  810. <style lang='scss' scoped>
  811. page {
  812. background: #F5F6FA;
  813. }
  814. .title_b {
  815. margin: 20rpx 20rpx 0rpx 20rpx;
  816. padding: 20rpx 10rpx 20rpx 10rpx;
  817. font-size: 18px;
  818. font-weight: 550;
  819. }
  820. .c-row {
  821. display: -webkit-box;
  822. display: -webkit-flex;
  823. display: flex;
  824. -webkit-box-align: center;
  825. -webkit-align-items: center;
  826. align-items: center;
  827. padding: 20rpx 30rpx;
  828. position: relative;
  829. }
  830. .con-list {
  831. -webkit-box-flex: 1;
  832. -webkit-flex: 1;
  833. flex: 1;
  834. display: -webkit-box;
  835. display: -webkit-flex;
  836. display: flex;
  837. -webkit-box-orient: vertical;
  838. -webkit-box-direction: normal;
  839. -webkit-flex-direction: column;
  840. flex-direction: column;
  841. color: #303133;
  842. line-height: 40rpx;
  843. text-align: right;
  844. padding-right: 20rpx;
  845. }
  846. .wrap {
  847. padding-bottom: 10px;
  848. font-size: 14px;
  849. background: #fff;
  850. margin: 10px;
  851. border-radius: 10px;
  852. input {
  853. font-size: 14px;
  854. }
  855. >.title {
  856. padding: 10px 16px;
  857. }
  858. }
  859. .footer {
  860. background: #fff;
  861. position: fixed;
  862. bottom: 0;
  863. width: 100%;
  864. padding: 20px 10px;
  865. z-index: 10;
  866. .button {
  867. background: #22C572;
  868. width: 90%;
  869. margin: 20rpx auto;
  870. padding: 10px;
  871. color: #fff;
  872. text-align: center;
  873. border-radius: 30px;
  874. }
  875. }
  876. .buns_item{
  877. display: flex;
  878. padding: 80rpx 0 50rpx 0;
  879. justify-content: space-around;
  880. }
  881. .but_css{
  882. background: #22C572;
  883. width: 40%;
  884. padding: 20rpx;
  885. color: #fff;
  886. text-align: center;
  887. border-radius: 20rpx;
  888. }
  889. </style>