From 0ab8c82c603f14cf69396b54b0471112b9de947b Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期三, 11 九月 2024 10:32:14 +0800 Subject: [PATCH] update 会员优惠券等 --- sub_pages/supplier/flower-manage/flower-add.vue | 166 +++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 118 insertions(+), 48 deletions(-) diff --git a/sub_pages/supplier/flower-manage/flower-add.vue b/sub_pages/supplier/flower-manage/flower-add.vue index 312d21f..cfd84fe 100644 --- a/sub_pages/supplier/flower-manage/flower-add.vue +++ b/sub_pages/supplier/flower-manage/flower-add.vue @@ -98,7 +98,11 @@ <view class="form-item before-line"> <view class="label required">商品等级</view> <view class="m-l-a m-r-0 flex " :class="[!dto.level?'desc-gray':'']" @click="()=>{ - show_select_level=true + if(dto.category){ + show_select_level=true + }else{ + $message.showToast('请选择分类') + } }"> <view>{{dto.levelStr||dto.level || '请选择'}}</view> <u-icon class="m-l-a" name="arrow-right"></u-icon> @@ -110,15 +114,13 @@ <view class="form-item before-line"> <view class="label required">售价(元)</view> <view class="m-l-a m-r-0 flex"> - <input v-model="dto.price" placeholder="请输入数字" type="digit" - style="margin-top: 16px;text-align: right;"></input> + <input v-model="dto.price" placeholder="请输入数字" type="digit" class="text-right m-t-15"></input> </view> </view> <view class="form-item "> <view class="label required">库存</view> <view class="m-l-a m-r-0 flex"> - <input v-model="dto.stock" placeholder="请输入数字" type="number" - style="margin-top: 16px;text-align: right;"></input> + <input v-model="dto.stock" placeholder="请输入数字" type="number" class="text-right m-t-15"></input> </view> </view> @@ -146,8 +148,17 @@ </view> <view class="line-gray-big"></view> + <view class="form-item before-line"> + <view class="label">商品描述</view> + <view class="m-l-a m-r-0 flex"> - <view class="form-item before-line"> + </view> + </view> + <view style="min-width: 500rpx;margin-left: 20rpx;margin-right: 20rpx;margin-top: 20rpx;"> + <u--textarea v-model="dto.description" autoHeight placeholder="请输入商品描述"></u--textarea> + </view> + + <view class="form-item bottom-border-no"> <view class="label">商品视频</view> <view class="m-l-a m-r-0 flex"> <!-- :style="{'background-image':dto.icon&&`url('${dto.icon}')`||''}" --> @@ -158,20 +169,12 @@ </view> </view> <view v-if="dto.video"> - <video :src="dto.video" :auto-pause-if-navigate="true" style="display: block;margin: 0 auto;"></video> - </view> - <view class="form-item bottom-border-no"> - <view class="label">商品描述</view> - <view class="m-l-a m-r-0 flex"> - - </view> - </view> - <view style="min-width: 500rpx;margin-left: 20rpx;margin-right: 20rpx;margin-top: 20rpx;"> - <u--textarea v-model="dto.description" autoHeight placeholder="请输入商品描述"></u--textarea> + <video :src="dto.video" :auto-pause-if-navigate="true" style="display: block;margin: 0 auto;"></video> </view> - <view style="min-height: 200rpx;"> + + <view style="min-height: 240rpx;"> </view> <view class="button-green-1 m-t-20 button-fixed-bottom " @click="submit" v-if="!dto.id"> @@ -264,6 +267,7 @@ columns_categorys_dict: {}, columns_categorys_search: '', columns_levels: [], + columns_levels_all: [], // columns_params: [], //弹窗选择具体的值 // cancel: { // color: '#999', @@ -303,6 +307,7 @@ } }).then(res => { var data = res.data + this.columns_levels_all = data || [] this.columns_levels = [data || []] // this.columns_levels[0].unshift({ // label: '全部', @@ -337,17 +342,17 @@ }, methods: { - updateValue(item, value) { - - if (item.name == '优点' || item.name === '缺点') { - if (item.value.indexOf(value) < 0) { - item.value.push(value) - } else { - item.value.splice(item.value.indexOf(value), 1) - } - } else { - //单选 - item.value = [value] + updateValue(item, value) { + + if (item.name == '优点' || item.name === '缺点') { + if (item.value.indexOf(value) < 0) { + item.value.push(value) + } else { + item.value.splice(item.value.indexOf(value), 1) + } + } else { + //单选 + item.value = [value] } this.$forceUpdate() @@ -360,19 +365,58 @@ this.$refs.picker_category.selectedClear() }, async PickCategory(item, e) { - console.log('PickCategory', item, e) + console.log('PickCategory', item, e, this.columns_categorys_dict) if (e.detail.value) { var currentnode = this.columns_categorys_dict['@' + e.detail.value[e.detail.value.length - 1] .value] + let levelLimit = currentnode && currentnode.levelLimit || '' + if (!levelLimit) { + if (currentnode.parentId) { + var currentnodeParentNode = this.columns_categorys_dict['@' + currentnode.parentId] + if (currentnodeParentNode) { + levelLimit = currentnodeParentNode.levelLimit || '' + } + } + } + + let tmpe = e + + if (this.dto.category && this.dto.category !== currentnode.id) { this.$message.confirm('修改分类将清空商品参数,确定修改吗').then(async res => { // console.log('currentnode',currentnode,this.columns_categorys_dict,'@'+e.detail.value[e.detail.value.length - 1].value) this.dto.categoryStr = currentnode.name this.dto.category = currentnode.id + this.dto.name = currentnode.name this.dto.unit = currentnode.unit this.dto.color = currentnode.color + //设置等级 + // console.log('tmpe', currentnode) + if (levelLimit) { + + this.columns_levels = [] + var tarr = [] + var filterLevel = levelLimit.split(",") + for (var t of this.columns_levels_all) { + if (filterLevel.indexOf(t.value) >= 0) { + tarr.push(t) + } + } + this.columns_levels = [tarr] + //如果不包含等级需要清除 + if (this.dto.level) { + if (filterLevel.indexOf(this.dto.level) >= 0) { + + } else { + this.dto.level = '' + this.dto.levelStr = '' + } + } + } else { + this.columns_levels = [this.columns_levels_all] + } //递归获取category的其他数据,用来做map? this.$message.showLoading() await this.refresh_category() @@ -382,6 +426,31 @@ this.$refs.picker_category.onchange(tmpe.detail.value) }) } else { + //设置等级 + // console.log('tmpe', currentnode) + if (levelLimit) { + + this.columns_levels = [] + var tarr = [] + var filterLevel = levelLimit.split(",") + for (var t of this.columns_levels_all) { + if (filterLevel.indexOf(t.value) >= 0) { + tarr.push(t) + } + } + this.columns_levels = [tarr] + //如果不包含等级需要清除 + if (this.dto.level) { + if (filterLevel.indexOf(this.dto.level) >= 0) { + + } else { + this.dto.level = '' + this.dto.levelStr = '' + } + } + } else { + this.columns_levels = [this.columns_levels_all] + } this.dto.categoryStr = currentnode.name this.dto.category = currentnode.id this.dto.name = currentnode.name @@ -511,9 +580,10 @@ } else { k.value = k.value.split(',') || [] } - } + } // console.log('init params',this.dto.params) } + } }, @@ -540,17 +610,17 @@ // // console.log('this.dto', this.dto) if (!this.dto.bannerList) { this.dto.bannerList = [] - } - if(this.dto.params){ - for (var k of this.dto.params) { - if (!k.value) { - k.value = [] - } else { - k.value = k.value.split(',') || [] - } - } - } - + } + if (this.dto.params) { + for (var k of this.dto.params) { + if (!k.value) { + k.value = [] + } else { + k.value = k.value.split(',') || [] + } + } + } + // if (this.dto.category) { // await this.refresh_category() // } @@ -595,8 +665,8 @@ this.$message.showToast(`${field.name}信息未填写`) return } - } - + } + if (this.dto.params.length < 1) { this.$message.showToast('商品参数详情未设置') return @@ -625,11 +695,11 @@ // this.$message.showToast('1') // return - var dto = JSON.parse(JSON.stringify(this.dto)) - if(dto.params){ - for(var k of dto.params){ - k.value = k.value.join(",") - } + var dto = JSON.parse(JSON.stringify(this.dto)) + if (dto.params) { + for (var k of dto.params) { + k.value = k.value.join(",") + } } this.$message.showLoading() const re = await this.$http.request('post', `/api/supplier/flower/list/${this.id?'edit':'new'}`, { -- Gitblit v1.9.3