From 8af3db52a632968206ca2bc7f9bd6b4662350232 Mon Sep 17 00:00:00 2001 From: xuxy <1059738716@qq.com> Date: 星期二, 25 六月 2024 11:50:18 +0800 Subject: [PATCH] 商品管理 --- pages/farmer/flower-manage/flower-add.vue | 191 +++++++++++++++++++---------------------------- 1 files changed, 77 insertions(+), 114 deletions(-) diff --git a/pages/farmer/flower-manage/flower-add.vue b/pages/farmer/flower-manage/flower-add.vue index bf2fb5f..421428e 100644 --- a/pages/farmer/flower-manage/flower-add.vue +++ b/pages/farmer/flower-manage/flower-add.vue @@ -3,12 +3,12 @@ <view> <view class="form-item"> <view class="label required">商品分类</view> - <view class="m-l-a m-r-0 flex " :class="[!dto.applicationType?'desc-gray':'']" @click="()=>{ + <view class="m-l-a m-r-0 flex " :class="[!dto.category?'desc-gray':'']" @click="()=>{ if(!id){ - show_select_type=true + show_select_category=true } }"> - <view>{{dto.applicationTypeStr||dto.applicationType || '请选择'}}</view> + <view>{{dto.categoryStr||dto.category || '请选择'}}</view> <u-icon class="m-l-a" name="arrow-right"></u-icon> </view> @@ -112,16 +112,16 @@ </view> - - - <view class="button-green-1 m-t-20 button-fixed-bottom before-line" @click="submit"> + <view class="button-green-1 m-t-20 button-fixed-bottom before-line" @click="submit" v-if="!dto.id"> 提交审核 </view> - + <view class="button-green-1 m-t-20 button-fixed-bottom before-line" @click="submit" v-if="dto.id"> + 修改 + </view> </view> - <u-picker @confirm="select_type" keyName="label" @cancel="show_select_type=false" :show="show_select_type" + <u-picker @confirm="select_category" keyName="label" @cancel="show_select_category=false" :show="show_select_category" :columns="columns_types"></u-picker> <u-picker @confirm="select_user" keyName="label" @cancel="show_select_user=false" :show="show_select_user" @@ -133,7 +133,6 @@ <script> import environments from '@/environments' - import xflSelect from '@/components/xfl-select/xfl-select.vue'; //导入 import { mapState @@ -144,76 +143,63 @@ data() { return { id: '', - orderId: '', - show_addlog: false, - log_remarks: '', - refresh: false, - api: '', dto: { id: '', - applicationType: '', + name: '', + category: '', + unit: '', + color: '', + cover: '', + bannerList: [], //str[] + video: '', + level: '', //FLOWER_LEVEL + price: 0.00, + stock: 0, + params: [], //id,value }, - show_select_type: false, + show_select_category: false, show_select_user: false, - columns_types: [], - audit_remarks: '', - audit_result: false, - show_audit: false, - - - //审核方式 - shTypeList: [{ - name: '身份证', - disabled: false - }, - { - name: '营业执照', - disabled: false - } - ], - radiovalue1: '身份证', + columns_categorys: [], + columns_levels:[], } }, - onLoad(options) { + async onLoad(options) { if (options.id) { this.id = options.id this.getDetail() } else { - // this.$http.request('get', '/api/personnel/employee/list', { - // params: { - // size: 4000, - // current: 1 - // } - // }).then(res => { - // this.userListAll = (res.data && res.data.records || []).map(item => { - // item.label = item.label || item.name || item.nickName || item.loginName || '-' - // return item - // }) - // var index = 0 - // this.userList = this.userListAll.map(item => { - // index += 1 - // return `${index}.` + item.label + (item.tel ? `(${item.tel})` : '') - // }) - // var arr = this.userListAll.map(item => { - // return { - // label: item.label + (item.tel ? `(${item.tel})` : ''), - // value: item.id - // } - // }) - // this.userListCols = [arr] - - // }) - - - this.$http.request('get', '/api/dict/value', { + if (options.copyId) { + this.id = options.copyId + await this.getDetail() + this.id = '' + delete this.dto.id + } + + //tree + this.$http.request('get', '/api/flower/category/tree', { params: { - typeCode: 'APPLICATION_TYPE' + typeCode: 'FLOWER_LEVEL' } }).then(res => { var data = res.data - this.columns_types = [data || []] - this.columns_types[0].unshift({ + this.columns_categorys = [data || []] + this.columns_categorys[0].unshift({ + label: '全部', + value: '', + children:[] + }) + + }) + + this.$http.request('get', '/api/dict/value', { + params: { + typeCode: 'FLOWER_LEVEL' + } + }).then(res => { + var data = res.data + this.columns_levels = [data || []] + this.columns_levels[0].unshift({ label: '全部', value: '' }) @@ -226,10 +212,10 @@ methods: { - select_type(e) { - this.show_select_type = false - this.dto.applicationTypeStr = e.value[0].label - this.dto.applicationType = e.value[0].value + select_category(e) { + this.show_select_category = false + this.dto.categoryStr = e.value[0].label + this.dto.category = e.value[0].value }, select_user(e) { this.show_select_user = false @@ -242,16 +228,16 @@ const { code, data - } = await this.$http.request('get', "/api/app/application/get/" + this.id, {}) + } = await this.$http.request('get', "/api/supplier/flower/list/view?id=" + this.id, {}) if (code == 0) { this.dto = { ...data, } - if (this.dto.applicationDate) { - this.dto.applicationDate = this.$util.toDate(new Date(this.dto.applicationDate)) - } - // console.log('this.dto', this.dto) + // if (this.dto.applicationDate) { + // this.dto.applicationDate = this.$util.toDate(new Date(this.dto.applicationDate)) + // } + // // console.log('this.dto', this.dto) } @@ -259,64 +245,41 @@ }, async submit() { - if (!this.dto.applicationType) { - this.$message.showToast('未选择类型') - return - } - if (!this.dto.applicationTitle) { - this.$message.showToast('未填写申请主题') - return - } - if (!this.dto.auditPersonId) { - this.$message.showToast('未选择审批人') - return - } - await this.$message.confirm(`是否确定提交申请${this.auditPersonName?(",审批人为:"+this.auditPersonName):""}`) + // if (!this.dto.applicationType) { + // this.$message.showToast('未选择类型') + // return + // } + // if (!this.dto.applicationTitle) { + // this.$message.showToast('未填写申请主题') + // return + // } + // if (!this.dto.auditPersonId) { + // this.$message.showToast('未选择审批人') + // return + // } + // await this.$message.confirm(`是否确定提交申请${this.auditPersonName?(",审批人为:"+this.auditPersonName):""}`) // this.$message.showToast('1') // return var dto = { ...this.dto, - applicationDate: this.$util.toDate(new Date()), - applicantId: this.currentInfo.id + // applicationDate: this.$util.toDate(new Date()), + // applicantId: this.currentInfo.id } this.$message.showLoading() - const re = await this.$http.request('post', '/api/app/application/create', { + const re = await this.$http.request('post', `/api/supplier/flower/list/${this.id?'edit':'new'}`, { data: dto }) this.$message.hideLoading() if (re.code == 2000 || re.code == 0) { this.$message.showToast('操作成功') //需要标记加一下 - this.$store.dispatch('sign_add', 'application'); + // this.$store.dispatch('sign_add', 'application'); this.backpage() } }, - async submitAudit() { - var url = '' - if (this.audit_result) { - url = '/api/app/application/audit/pass' - } else { - url = '/api/app/application/audit/reject' - } - var dto = { - id: this.id, - auditRemarks: this.audit_remarks - } - this.show_audit = false - this.$message.showLoading() - const re = await this.$http.request('post', url, { - data: dto - }) - this.$message.hideLoading() - if (re.code == 2000 || re.code == 0) { - this.$message.showToast('操作成功') - this.$store.dispatch('sign_add', 'application'); - this.getDetail() - } - }, uploadIcon(key) { const that = this uni.chooseImage({ @@ -351,7 +314,7 @@ ...mapState(['currentInfo']) }, components: { - xflSelect + } } </script> -- Gitblit v1.9.3