123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667 |
- <template>
- <view>
- <view class='wrap'>
- <view class='title_b'>基本信息</view>
- <view class="c-row ">
- <view class="title">仓库</view>
- <view class="con-list">
- {{gridList.warehouseName}}
- </view>
- </view>
- <view class="c-row ">
- <view class="title">编号</view>
- <view class="con-list">
- {{gridList.qualityNo}}
- </view>
- </view>
- <view class="c-row ">
- <view class="title">客户</view>
- <view class="con-list">
- <view @click='gocustomer' v-if='gridList.customerName'>
- {{gridList.customerName}}({{gridList.customerPhone}})
- </view>
- <view @click='gocustomer' v-else>
- 选择客户
- </view>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">车牌号</view>
- <view class="con-list">
- <input v-model='gridList.carNumber' placeholder="请输入车牌号"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">扣重比</view>
- <view class="con-list">
- <input v-model='gridList.buckleWeightRatio' placeholder="请输入扣重比"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">购粮性质</view>
- <view class="con-list">
- <input v-model='gridList.natureOfGrainPurchase' placeholder="请输入购粮性质"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">仓位号</view>
- <view class="con-list">
- <view @click='show=true'>{{gridList.binNumber?gridList.binNumber:'请选择仓位号'}}</view>
- <u-picker :range="warehouseList" range-key="binNumber" @confirm='binNumberpicker($event)' v-model="show" mode="selector" >
- </u-picker>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">囤位号</view>
- <view class="con-list">
- <input v-model='gridList.storageTagNo' placeholder="请输入囤位号"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">货名</view>
- <view class="con-list">
- <view @click='show2=true'>{{gridList.goodsName}}</view>
- <u-picker :range="goodsList" range-key="goodsName" @confirm='goodspicker($event)' v-model="show2" mode="selector" >
- </u-picker>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">类型</view>
- <view class="con-list">
- <view @click='show3=true'>{{gridList.type}}</view>
- <u-picker :range="typeList" @confirm='typepicker($event)' v-model="show3" mode="selector" >
- </u-picker>
- </view>
- </view>
- <view v-if="gridList.type == '潮粮'" class="c-row">
- <view class="title">净重单价(元/公斤)</view>
- <view class="con-list">
- <input v-model='gridList.tidalGrainPrice' disabled placeholder="自动获取,不可编辑"
- name="input"></input>
- </view>
- </view>
- <view v-if="gridList.type == '干粮'" class="c-row">
- <view class="title">干粮单价(元/公斤)</view>
- <view class="con-list">
- <input v-model='gridList.dryGrainPrice' placeholder="请输入干粮单价"
- name="input"></input>
- </view>
- </view>
- </view>
- <view style='margin-bottom:300rpx;' class='wrap'>
- <view class='title_b'>化验信息</view>
- <view class="c-row ">
- <view class="title">等级</view>
- <view class="con-list">
- <view @click='show1=true'>{{gridList.grade?gridList.grade:'请选择等级'}}</view>
- <u-picker :range="gradeList" range-key="value" @confirm='gradepicker($event)' v-model="show1" mode="selector" >
- </u-picker>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">水分(%)</view>
- <view class="con-list">
- <input v-model='gridList.waterContent' placeholder="请输入水分占比" @input="waterContentChange"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">容重(克/升)</view>
- <view class="con-list">
- <input v-model='gridList.bulkDensity' placeholder="请输入容重"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">不完善粒(%)</view>
- <view class="con-list">
- <input v-model='gridList.imperfectGrain' placeholder="请输入不完整粒占比"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">杂质(%)</view>
- <view class="con-list">
- <input v-model='gridList.impurity' placeholder="请输入杂质占比"
- name="input"></input>
- </view>
- </view>
- <view class="c-row ">
- <view class="title">霉变粒(%)</view>
- <view class="con-list">
- <input v-model='gridList.mildewGrain' placeholder="请输入霉变粒占比"
- name="input"></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">热损伤(%)</view>
- <view class="con-list">
- <input v-model='gridList.jiaorenli' placeholder="请输入热损伤占比"
- name="input"></input>
- </view>
- </view>
- </view>
- <view class="footer">
- <view @click='submit' class="button">提交</view>
- </view>
- </view>
- </template>
- <script>
- import dragButton from "@/components/drag-button/drag-button.vue";
- import {
- mapState
- } from 'vuex';
- let startY = 0,
- moveY = 0,
- pageAtTop = true;
- export default {
- components: {
- dragButton
- },
- data() {
- return {
- inputShow: false,
- modalName: '',
- mycarStyle: '',
- feild: undefined,
- id:0,
- show:false,
- selector:[],
- show1:false,
- inputContent: '',
- coverTransform: 'translateY(0px)',
- coverTransition: '0s',
- moving: false,
- footprintList: [],
- searchKeyWord:'',
- isVip: false,
- userInfoTmp: [],
- inputStatus: 'none',
- carInfo: [],
- gridCol: 4,
- pageSize:10,
- show3:false,
- show2:false,
- goodsList:[],
- currentPage:1,
- gridBorder: false,
- headUrl:"../../static/img/myimg/YongHu@3x.png",
- userphone:"",
- username:"请更改昵称",
- gridList: {
- natureOfGrainPurchase:'贸易粮',
- type:'潮粮',
- tidalGrainPrice:'',
- dryGrainPrice:''
- },
- typeList:['潮粮','干粮'],
- managementType:'',
- warehouseName: '',
- warehouseList:[],
- warehouseCount:'',
- commonWarehouseNo:'',
- showTran: true,
- companyId: 1,
- current: 4,
- gradeList:[
- {key:1,value:'一等品'},
- {key:2,value:'二等品'},
- {key:3,value:'三等品'},
- {key:4,value:'等外'},
- ],
- cangid:''
- }
- },
- // #ifndef MP
- onNavigationBarButtonTap(e) {
- const index = e.index;
- if (index === 0) {
- this.navTo('/pages/set/set');
- } else if (index === 1) {
- // #ifdef APP-PLUS
- const pages = getCurrentPages();
- const page = pages[pages.length - 1];
- const currentWebview = page.$getAppWebview();
- currentWebview.hideTitleNViewButtonRedDot({
- index
- });
- // #endif
- uni.navigateTo({
- url: '/pages/notice/notice'
- })
- }
- },
- // #endif
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- // 手机号中间4位加*
- starUserphone(){
- let reg = /^(\d{3})\d{4}(\d{4})$/;
- if(this.userphone){
- return this.userphone.replace(reg, "$1****$2");
- }
- }
- },
- onLoad(options){
-
- this.commonWarehouseNo=options.commonWarehouseNo
- this.warehouseCount=Number(options.warehouseCount) + 1
- let number = '000' + this.warehouseCount
- number = number.substring(number.length - 4, number.length)
- this.gridList.warehouseName=options.warehouseName
- this.gridList.qualityNo='SGRK' + this.getdate() + this.commonWarehouseNo + number
- this.purchasePriceList=uni.getStorageSync('purchasePriceList')
- this.cangid=options.cangid
- this.managementType=options.managementType
- },
- onShow() {
- if(uni.getStorageSync('checkcustomer')){
- this.gridList.customerName=uni.getStorageSync('checkcustomer').customerName
- this.gridList.customerPhone=uni.getStorageSync('checkcustomer').customerPhone
- }
- this.gridList.grade=this.gradeList[0].value
- this.gridList.gradeKey=this.gradeList[0].key
- var that = this
- this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer',{
- compId:'',
- authenticationStatusKey:7
- }).then(res => {
- if(res.data.data){
- // let data = res.data.data
- // that.gridList =data
- that.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse',{
- id:this.cangid
- }).then(res => {
- that.warehouseList=res.data.data.warehousePositionInfoList
- })
- }
- })
- this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName',{
- warehouseId:this.cangid
- }).then(res => {
- if(res.data.data){
- this.goodsList = res.data.data
- if(this.goodsList.length > 0){
- this.gridList.goodsName=this.goodsList[0].goodsName
- this.waterContentChange()
- }
-
- // for (let i = 0; i < res.data.data.length; i++) {
- // this.goodsList.push(res.data.data[i].goodsName)
- // }
- // if(this.goodsList.some(item=>{return item.goodsName=='玉米'})){
- // this.gridList.goodsName='玉米'
- // uni.setStorageSync('goodsName',this.gridList.goodsName)
- // }else{
- // this.gridList.goodsName=this.goodsList[0].goodsName
- // uni.setStorageSync('goodsName',this.gridList.goodsName)
- // }
- }
- })
- },
- methods: {
- waterContentChange() {
- var that = this
- if (this.gridList.goodsName) {
- for (var i = 0; i < this.purchasePriceList.length; i++) {
- if (this.purchasePriceList[i].goodsName == this.gridList.goodsName) {
- this.gridList.buckleWeightRatio = this.purchasePriceList[i].deductWeight
- }
- }
- }
- var numReg = /^[0-9]*$/
- var numRe = new RegExp(numReg)
- //潮粮单价改变事件
- if (
- this.gridList.goodsName &&
- this.gridList.waterContent &&
- this.gridList.grade&&
- numRe.test(this.gridList.waterContent)
- ) {
- this.$api.doRequest('get', '/purchasePrice/tidalGrainPrice',{
- warehouseId:this.cangid,
- goodsName:this.gridList.goodsName,
- waterContent: this.gridList.waterContent,
- grade: this.gridList.grade,
- }).then(res => {
- that.gridList.tidalGrainPrice = res.data.data
- })
- }
- },
- gocustomer(){
- uni.navigateTo({
- url:'/pages/erpbusiness/customer'
- })
- },
- getdate() {
- var date = new Date()
- var year = date.getFullYear() //获取完整的年份(4位)
- var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
- var datetime = date.getDate() //获取当前日(1-31)
- if (mouth < 10) {
- mouth = '0' + mouth
- }
- if (datetime < 10) {
- datetime = '0' + datetime
- }
- return year +'' + mouth + '' + datetime
- },
- submit(){
- var that = this
- if (!this.gridList.qualityNo) {
- this.$api.msg('编号不能为空')
- return
- }
- if (!this.gridList.binNumber) {
- this.$api.msg('仓位不能为空')
- return
- }
- if (!this.gridList.customerName) {
- this.$api.msg('客户不能为空')
- return
- }
- if (!this.gridList.storageTagNo) {
- this.$api.msg('囤位号不能为空')
- return
- }
- if (this.gridList.storageTagNo.length > 10) {
- this.$api.msg('囤位号不能为空')
- return
- }
- if (!this.gridList.carNumber) {
- this.$api.msg('车牌号不能为空')
- return
- }
- if (this.gridList.carNumber.length != 7) {
- this.$api.msg('车牌号输入错误')
- return
- }
- if (!this.gridList.goodsName) {
- this.$api.msg('货名不能为空')
- return
- }
- if (this.gridList.buckleWeightRatio < 0 ||this.gridList.buckleWeightRatio > 2) {
- this.$api.msg('扣重比输入错误')
- return
- }
- if (
- String(this.gridList.buckleWeightRatio).indexOf('.') != -1 &&
- String(this.gridList.buckleWeightRatio).length -
- (String(this.gridList.buckleWeightRatio).indexOf('.') + 1) > 2)
- {
- this.$api.msg('扣重比输入错误')
- return
- }
- if (!this.gridList.type) {
- this.$api.msg('类型不能为空')
- return
- }
- if (!this.gridList.natureOfGrainPurchase) {
- this.$api.msg('购粮性质不能为空')
- return
- }
- if (!this.gridList.grade) {
- this.$api.msg('等级不能为空')
- return
- }
- if (!this.gridList.impurity) {
- this.$api.msg('杂质不能为空')
- return
- }
- if (!this.gridList.waterContent) {
- this.$api.msg('水分不能为空')
- return
- }
- if (!this.gridList.mildewGrain) {
- this.$api.msg('霉变粒不能为空')
- return
- }
- if (!this.gridList.bulkDensity) {
- this.$api.msg('容重不能为空')
- return
- }
- if (!this.gridList.jiaorenli) {
- this.$api.msg('热损伤不能为空')
- return
- }
- if (!this.gridList.imperfectGrain) {
- this.$api.msg('不完整粒不能为空')
- return
- }
- uni.showModal({
- content: "确定提交质检信息?",
- showCancel: true,
- confirmText: '提交',
- success: function(res) {
- if (res.confirm) {
- that.$api.doRequest('post', '/qualityInspectionManagement/api/addQualityInspection',that.gridList).then(res => {
- if(res.data.code==200){
- that.$api.msg('提交成功')
- uni.navigateBack({
- })
- }else{
- hat.$api.msg('提交失败')
- }
- })
- }
- }
- })
- },
- gradepicker(e){
- console.log(e)
- // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
- this.gridList.grade=this.gradeList[e[0]].value
- this.gridList.gradeKey=this.gradeList[e[0]].key
- this.waterContentChange()
- },
- goodspicker(e){
- console.log(e)
- // this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
- this.gridList.goodsName=this.goodsList[e[0]].goodsName
- uni.setStorageSync('goodsName',this.gridList.goodsName)
- if(this.gridList.type == "干粮" && this.gridList.goodsName){
- this.$api.doRequest('get', '/purchasePrice/dryGrainPrice',{
- warehouseId:this.cangid,
- goodsName:this.gridList.goodsName
- }).then(res => {
- that.gridList.dryGrainPrice = res.data.data
- })
- }
- this.waterContentChange()
- },
- typepicker(e){
- var that = this
- this.gridList.type=this.typeList[e[0]]
- if(this.gridList.type == "干粮" &&this.gridList.goodsName){
- this.$api.doRequest('get', '/purchasePrice/dryGrainPrice',{
- warehouseId:this.cangid,
- goodsName:this.gridList.goodsName
- }).then(res => {
- that.gridList.dryGrainPrice = res.data.data
- })
- }
- },
- binNumberpicker(e){
- this.gridList.binNumber=this.warehouseList[e[0]].binNumber
- },
- del(item){
- this.$api.doRequest('get', '/qualityInspectionManagement/api/deleteQualityInspection',{
- id:item.id
- }).then(res => {
- if(res.data.code==200){
- this.$api.msg('删除成功')
- }else{
- this.$api.msg('系统异常,请联系管理员')
- }
- })
- },
- contactUs() {
- const that = this
- uni.makePhoneCall({
- // 手机号
- phoneNumber: '18241771147',
- // 成功回调
- success: (res) => {},
- // 失败回调
- fail: (res) => {}
- });
- },
- loadData() {
- // const that = this
- // if(uni.getStorageSync("PageCur")){
- // that.PageCur = uni.getStorageSync("PageCur");
- // }
- // that.userInfoTmp = uni.getStorageSync("userInfo")
- // uni.showLoading({
- // title: '正在加载',
- // mask:true
- // })
- // that.$api.request('integral', 'getIndexData', failres => {
- // that.$api.msg(failres.errmsg)
- // uni.hideLoading()
- // }).then(res => {
- // let data = res.data
- // uni.setStorageSync("message", data.message);
- // uni.setStorageSync("task", data.task);
- // uni.setStorageSync("contract", data.contract);
- // uni.setStorageSync('showTran', data.showTran);
- // that.showTran = data.showTran
- // that.gridList[4].tips = data.task
- // that.gridList[2].tips = data.contract
- // that.companyId = data.companyId
- // uni.hideLoading()
- // })
- },
- confirm() {
- const that = this
- if (!that.inputContent) {
- that.$api.msg('输入不能为空')
- return
- }
- let obj = {}
- obj[that.feild] = that.inputContent
- that.$api.request('user', 'syncUserInfo', obj).then(res => {
- that.userInfo.nickname = that.inputContent
- that.inputContent = ''
- that.$store.commit('login', that.userInfo)
- })
- },
- cancel() {
- this.inputShow = false
- this.inputStatus = 'none'
- this.genderShow = false
- },
- myAccount() {
- uni.navigateTo({
- url: `/pageA/pages/contract`
- })
- },
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- }
- uni.navigateTo({
- url
- })
- },
- mycarClick(carNo) {
- this.modalName = null
- uni.navigateTo({
- url: `/pageB/car/mycar_detail?carNo=${carNo}`
- })
- },
- scanCode() {
- uni.scanCode({
- success: function(res) {
- uni.navigateTo({
- url: res.result
- })
- }
- })
- },
- hideModal(e) {
- this.modalName = null
- },
- }
- }
- </script>
- <style lang='scss' scoped>
- page{
- background:#F5F6FA;
- }
- .title_b {
- margin: 20rpx 20rpx 0rpx 20rpx;
- padding: 20rpx 10rpx 20rpx 10rpx;
- font-size: 18px;
- font-weight: 550;
- }
- .c-row {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- padding: 20rpx 30rpx;
- position: relative;
- }
-
- .con-list {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- color: #303133;
- line-height: 40rpx;
- text-align: right;
- padding-right: 20rpx;
- }
- .wrap{
- padding-bottom:10px;
- font-size:14px;
- background:#fff;margin:10px;border-radius:10px;
- input{
- font-size:14px;
- }
- >.title{
- padding:10px 16px;
- }
-
- }
- .footer{
- background:#fff;
- position:fixed;
- bottom:0;
- width:100%;
- padding:20px 10px;
- z-index:10;
- .button{
- background:#22C572;
- width:90%;
- margin:0 auto;
- padding:10px;
- color:#fff;
- text-align:center;
- border-radius: 30px;
- }
- }
- </style>
|