From 97d036401c836c47181b0db94ecd242bcef9fb3d Mon Sep 17 00:00:00 2001 From: rosehan <151435705@qq.com> Date: Sun, 28 Apr 2024 17:13:10 +0800 Subject: [PATCH] =?UTF-8?q?4=E6=9C=8826=E6=97=A5=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/traceability/company.js | 1 + pages/mine/index.vue | 3 +- static/scss/v-layout.scss | 42 +++++++++------ sunPages/mine/base/index.vue | 47 ++++++++++------ sunPages/mine/business/index.vue | 53 ++++++++++++------- .../traceability-product/loss/lossEdit.vue | 1 - .../traceability-product/machining/index.vue | 14 +++-- .../machining/materialsList.vue | 1 - .../traceability-product/sales/salesEdit.vue | 1 - 9 files changed, 98 insertions(+), 65 deletions(-) diff --git a/api/traceability/company.js b/api/traceability/company.js index 4527f5b..5f47793 100644 --- a/api/traceability/company.js +++ b/api/traceability/company.js @@ -12,6 +12,7 @@ export function getCompanyPage(params) { // 更新企业信息 export function updateCompany(data) { + return request({ url: '/traceability/company/update', method: 'put', diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 1694e02..402494a 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -97,7 +97,6 @@ this.$tab.navigateTo('/sunPages/mine/info/edit') }, handleToSetting() { - console.log('32') this.$tab.navigateTo('/sunPages/mine/setting/index') }, handleToLogin() { @@ -235,4 +234,4 @@ } } } - \ No newline at end of file + diff --git a/static/scss/v-layout.scss b/static/scss/v-layout.scss index e559ede..0951b3c 100644 --- a/static/scss/v-layout.scss +++ b/static/scss/v-layout.scss @@ -299,7 +299,7 @@ $v-muted: #dddddd; margin-bottom: 20rpx; .v-materials-list-box { background-color: rgba(0, 0, 0, 0.02); - padding: 20rpx; + padding: 20rpx 20rpx 10rpx 20rpx; text-align: left; .v-materials-name { font-size: 32rpx; @@ -541,7 +541,6 @@ $v-muted: #dddddd; .v-form { .v-form-item { - position: relative; padding: 4rpx 40rpx 4rpx 40rpx; margin: 20rpx 0; @@ -556,24 +555,15 @@ $v-muted: #dddddd; } } } - .label-120{ - .uni-forms-item__label{width: 240rpx; } + .label-120 { + .uni-forms-item__label { + width: 240rpx; + } } .uni-forms-item__label { font-size: 28rpx; } - .total-input { - border: 1px solid #ccc; - margin-left: 10rpx; - align-items: center; - padding: 0 10rpx; - height: 60rpx; - line-height: 60rpx; - border-radius: 40rpx; - input { - line-height: 58rpx; - } - } + .uni-forms-item__content { position: relative; text-align: right; @@ -623,6 +613,26 @@ $v-muted: #dddddd; padding-right: 0; } } + + .no-right { + .uni-forms-item__content { + padding-right: 0; + .total-input { + align-items: center; + padding: 0 10rpx; + border: 1px solid #ccc; + border-radius: 40rpx; + } + .unit{font-size: 24rpx;} + input { + margin-left: 10rpx; + + height: 60rpx; + line-height: 54rpx !important; + } + } + } + .uni-forms-item__error { width: 100%; padding: 0 40rpx 0 0; diff --git a/sunPages/mine/base/index.vue b/sunPages/mine/base/index.vue index e56c638..ff84bbc 100644 --- a/sunPages/mine/base/index.vue +++ b/sunPages/mine/base/index.vue @@ -37,10 +37,10 @@ - + - + @@ -199,10 +199,9 @@ try { await this.getCompany() await this.getAddressList() - - const res = await BaseApi.getBase(this.baseId) this.formData = res.data + console.log('lai',this.formData) // 初始化当前公司 this.CompanyList.map((item, index, arr) => { @@ -230,8 +229,11 @@ this.LocalData.provinceCode = this.formData.province this.LocalData.cityCode = this.formData.city this.LocalData.areaCode = this.formData.district - this.imgList[0]=this.formData.baseImage - + if(this.formData.baseImage==""){ + this.imgList=[] + }else{ + this.imgList[0]=this.formData.baseImage + } } finally {} }, @@ -242,22 +244,18 @@ try { const that = this await this.$refs['formRef'].validate() - const data = this.formData - await BaseApi.updateBase(data) - console.log(this.formData) - + const data = this.formData + await BaseApi.updateBase(data) + await this.$store.dispatch('changeBaseName',that.formData.baseName) + await this.$store.dispatch('changeBaseLeader',that.formData.baseLeader) uni.showToast({ title: `保存成功`, icon: 'success', duration: 2000, complete: function() { - setTimeout(function() { - that.$store.dispatch('changeBaseName',that.formData.baseName) - that.$store.dispatch('changeBaseLeader',that.formData.baseLeader) - uni.redirectTo({ - url: '/pages/mine/index' - }); - }, 2000); + uni.redirectTo({ + url: '/pages/mine/index' + }); } }) } catch (err) { @@ -317,12 +315,27 @@ } }, ceshiImgDelete(e, num) { + this.imgList=[] + this.formData.baseImage="" console.log('ceshiImgDelete', e); }, ceshiUploadFail(err) { //上传失败 console.log('err', err); }, + + // 格式化小数两位 + handlerInput(event, index) { + this.$nextTick(() => { + const num = parseFloat(event.target.value).toFixed(2) + if (isNaN(num)) { + this.formData.productLoss = undefined + } else { + this.formData.productLoss = num + } + this.$forceUpdate() + }) + }, } } diff --git a/sunPages/mine/business/index.vue b/sunPages/mine/business/index.vue index 3bb553e..0bab619 100644 --- a/sunPages/mine/business/index.vue +++ b/sunPages/mine/business/index.vue @@ -16,7 +16,7 @@ - {{CompanyTypePickerList[CurrentCompanyType]}} @@ -26,7 +26,7 @@ - {{CompanyIndustryPickerList[CurrentCompanyIndustry]}} @@ -35,7 +35,7 @@ - + @@ -46,11 +46,9 @@ - - - @@ -166,24 +164,34 @@ async getListData() { try { this.getCompanyIndustry() - this.getCompanyType() + this.getCompanyType() const res = await CompanyApi.getCompanyPage(this.queryParams) this.formData = res.data.list[0] - console.log(this.formData) + console.log("lai",this.formData) this.queryParams.total = res.data.total; this.CurrentCompanyType = this.CompanyTypeList.findIndex(item => Number(item.value) === Number(this.formData.companyType)) this.CurrentCompanyIndustry = this.CompanyIndustryList.findIndex(item => Number(item .value) === Number(this.formData.companyIndustry)) + + if (this.formData.companyLicense == "") { + this.imgList = [] + } else { + this.imgList[0] = this.formData.companyLicense + } + if (this.formData.companyCertificate == "") { + this.imgList1 = [] + } else { + this.imgList1[0] = this.formData.companyCertificate + } } finally {} }, /** 提交按钮 */ async submitForm() { // 校验主表 - try { - this.formData.companyType = this.CompanyTypeList[this.currenCustomerType].value - this.formData.companyIndustry = this.CompanyIndustryList[this.CurrentCompanyIndustry].value + try { + console.log(this.formData) await this.$refs['formRef'].validate() const data = this.formData await CompanyApi.updateCompany(data) @@ -192,15 +200,13 @@ icon: 'success', duration: 2000, complete: function() { - setTimeout(function() { - uni.redirectTo({ - url: '/pages/mine/index' - }); - }, 2000); + uni.redirectTo({ + url: '/pages/mine/index' + }); } }) } catch (err) { - console.log("验证未通过",err) + console.log("验证未通过", err) } finally {} }, @@ -218,6 +224,7 @@ // 选择所属行业 CompanyIndustryChange(e) { this.CurrentCompanyIndustry = e.detail.value + this.formData.companyIndustry = this.CompanyIndustryList[this.CurrentCompanyIndustry].value }, // 获取企业类型 @@ -233,6 +240,7 @@ // 选择企业类型 CompanyTypeChange(e) { this.CurrentCompanyType = e.detail.value + this.formData.companyType = this.CompanyTypeList[this.CurrentCompanyType].value }, ceshiUploadSuccess(res) { @@ -254,6 +262,13 @@ } }, ceshiImgDelete(e, num) { + this.imgList = [] + this.formData.companyCertificate = "" + console.log('ceshiImgDelete', e); + }, + ceshiImgDelete1(e, num) { + this.imgList1 = [] + this.formData.companyCertificate = "" console.log('ceshiImgDelete', e); }, ceshiUploadFail(err) { @@ -265,4 +280,4 @@ + \ No newline at end of file diff --git a/sunPages/traceability-product/loss/lossEdit.vue b/sunPages/traceability-product/loss/lossEdit.vue index 0b1354a..6338bad 100644 --- a/sunPages/traceability-product/loss/lossEdit.vue +++ b/sunPages/traceability-product/loss/lossEdit.vue @@ -108,7 +108,6 @@ try { this.formData.lossType = this.LossTypeList[this.CurrenLossType].value - console.log(this.formData) await this.$refs['formRef'].validate() const data = this.formData await LossApi.createLoss(data) diff --git a/sunPages/traceability-product/machining/index.vue b/sunPages/traceability-product/machining/index.vue index 4140106..1600f49 100644 --- a/sunPages/traceability-product/machining/index.vue +++ b/sunPages/traceability-product/machining/index.vue @@ -85,8 +85,8 @@ 选择生产原料 - - + @@ -105,7 +105,7 @@ - 公斤 + 公斤 @@ -312,11 +312,9 @@ import {parseTime} from "@/utils/ruoyi.js"; icon: 'success', duration: 2000, complete: function() { - setTimeout(function() { - uni.redirectTo({ - url: '/pages/index' - }); - }, 2000); + uni.redirectTo({ + url: '/pages/index' + }); } }) } catch (err) { diff --git a/sunPages/traceability-product/machining/materialsList.vue b/sunPages/traceability-product/machining/materialsList.vue index add8bf2..5365a10 100644 --- a/sunPages/traceability-product/machining/materialsList.vue +++ b/sunPages/traceability-product/machining/materialsList.vue @@ -76,7 +76,6 @@ return item.cropperId }) this.saveData=this.reviceData.materialsList - console.log(this.selectData) } } else { this.reviceData = null; diff --git a/sunPages/traceability-product/sales/salesEdit.vue b/sunPages/traceability-product/sales/salesEdit.vue index 23e5b46..6132613 100644 --- a/sunPages/traceability-product/sales/salesEdit.vue +++ b/sunPages/traceability-product/sales/salesEdit.vue @@ -198,7 +198,6 @@ // 选择客户 ClientChange(e) { this.CurrenClient = e.detail.value - console.log(this.CurrenClient) this.formData.customId = this.ClientList[this.CurrenClient].id this.formData.customAddress = this.ClientList[this.CurrenClient].address this.formData.contacts = this.ClientList[this.CurrenClient].logisticsLeader