| | |
| | | <view class="container-page" style="padding: 0rpx;"> |
| | | <view> |
| | | <view class="form-item"> |
| | | <view class="label required">商品分类todo</view> |
| | | <view class="label required">商品分类</view> |
| | | <view class="m-l-a m-r-0 flex " :class="[!dto.category?'desc-gray':'']" @click="()=>{ |
| | | show_select_category=true |
| | | // show_select_category=true |
| | | $refs.picker_category.showPicker() |
| | | }"> |
| | | <view>{{dto.categoryStr||dto.category || '请选择'}}</view> |
| | | <u-icon class="m-l-a" name="arrow-right"></u-icon> |
| | |
| | | </view> |
| | | <view class="line-gray-big"></view> |
| | | |
| | | <view class="form-item"> |
| | | <!-- :style="{'background-image':dto.cover&&`url('${dto.cover}')`||''}" --> |
| | | <view class="form-item bottom-border-no"> |
| | | <view class="label required" style="width: 400rpx;">列表封面图(130*120px)</view> |
| | | <view class="m-l-a m-r-0 flex"> |
| | | <view class="component-button-upload" @click="uploadIcon('cover')" |
| | | :style="{'background-image':dto.icon&&`url('${dto.cover}')`||''}"> |
| | | <view class="component-button-upload" @click="uploadIcon('cover')"> |
| | | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="flex p20 form-item" style="padding-top: 0rpx;padding-bottom: 10rpx" v-if="dto.cover"> |
| | | <view class="m-t-12 m-r-10 "> |
| | | <image class="banner-img" :src="dto.cover" @click.stop="previewImg(dto.cover)"> |
| | | |
| | | </image> |
| | | <view class="t-red text-center" @click.stop="dto.cover=''">删除</view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="form-item before-line bottom-border-no"> |
| | | <view class="label required" style="width: 400rpx;">商品轮播图(300*160px)</view> |
| | | <view class="m-l-a m-r-0 flex"> |
| | |
| | | |
| | | } |
| | | }"> |
| | | <view>{{ '去设置'}}</view> |
| | | <view>{{ paramstr || '去设置'}}</view> |
| | | <u-icon class="m-l-a" name="arrow-right"></u-icon> |
| | | </view> |
| | | |
| | |
| | | 修改 |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- |
| | | |
| | | <u-picker @confirm="select_category" keyName="name" @cancel="show_select_category=false" |
| | | :show="show_select_category" :columns="columns_categorys"></u-picker> |
| | | :show="show_select_category" :columns="columns_categorys"></u-picker> --> |
| | | |
| | | <u-picker @confirm="select_level" keyName="label" @cancel="show_select_level=false" :show="show_select_level" |
| | | :columns="columns_levels"></u-picker> |
| | |
| | | <view class="button-green" @click="closeParamPop">返回</view> |
| | | </view> |
| | | </uni-popup> |
| | | |
| | | <dying318picker :picker-list="columns_categorys" ref="picker_category" @confirm="confirmPickerCategory"> |
| | | </dying318picker> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import environments from '@/environments' |
| | | import dying318picker from '@/components/dying318-picker/Picker.vue' |
| | | |
| | | import { |
| | | mapState |
| | |
| | | columns_categorys: [], |
| | | columns_levels: [], |
| | | // columns_params: [], //弹窗选择具体的值 |
| | | // cancel: { |
| | | // color: '#999', |
| | | // }, |
| | | // confirm: { |
| | | // color: '#20613D', |
| | | // }, |
| | | // column: [ |
| | | // {flex: 1}, |
| | | // {flex: 1}, |
| | | // {flex: 3}, |
| | | // ] |
| | | } |
| | | }, |
| | | async onLoad(options) { |
| | | //tree |
| | | this.$http.request('get', '/api/flower/category/tree', {}).then(res => { |
| | | var data = res.data |
| | | this.columns_categorys = data || [] |
| | | console.log('columns_categorys', this.columns_categorys) |
| | | |
| | | // this.columns_categorys = [data || []] |
| | | // this.columns_categorys[0].unshift({ |
| | | // label: '全部', |
| | | // value: '', |
| | | // children: [] |
| | | // }) |
| | | |
| | | }) |
| | | |
| | | this.$http.request('get', '/api/code/value', { |
| | | params: { |
| | | typeCode: 'FLOWER_LEVEL' |
| | | } |
| | | }).then(res => { |
| | | var data = res.data |
| | | this.columns_levels = [data || []] |
| | | this.columns_levels[0].unshift({ |
| | | label: '全部', |
| | | value: '' |
| | | }) |
| | | |
| | | }) |
| | | if (options.id) { |
| | | this.id = options.id |
| | | uni.setNavigationBarTitle({ |
| | |
| | | }) |
| | | } |
| | | |
| | | //tree |
| | | this.$http.request('get', '/api/flower/category/tree', {}).then(res => { |
| | | var data = res.data |
| | | this.columns_categorys = [data || []] |
| | | this.columns_categorys[0].unshift({ |
| | | label: '全部', |
| | | value: '', |
| | | children: [] |
| | | }) |
| | | |
| | | }) |
| | | |
| | | this.$http.request('get', '/api/code/value', { |
| | | params: { |
| | | typeCode: 'FLOWER_LEVEL' |
| | | } |
| | | }).then(res => { |
| | | var data = res.data |
| | | this.columns_levels = [data || []] |
| | | this.columns_levels[0].unshift({ |
| | | label: '全部', |
| | | value: '' |
| | | }) |
| | | |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | |
| | | methods: { |
| | | async confirmPickerCategory(picker) { |
| | | console.log('confirmPickerCategory', picker) |
| | | var id = picker.value |
| | | var name = picker.label |
| | | if (id !== this.dto.category) { |
| | | if (this.dto.category) { |
| | | await this.$message.confirm('修改分类将清空商品参数,确定修改吗') |
| | | } |
| | | this.dto.categoryStr = name |
| | | this.dto.category = id |
| | | this.$message.showLoading() |
| | | await this.refresh_category() |
| | | this.$message.hideLoading() |
| | | } |
| | | }, |
| | | closeParamPop() { |
| | | this.$refs.popup_param.close() |
| | | }, |
| | | |
| | | async select_category(e) { |
| | | if (e.value[0].id !== this.dto.category) { |
| | | if (this.dto.category) { |
| | | await this.$message.confirm('修改分类将清空商品参数,确定修改吗') |
| | | } |
| | | console.log('select_category', e) |
| | | this.show_select_category = false |
| | | this.dto.categoryStr = e.value[0].name |
| | | this.dto.category = e.value[0].id |
| | | this.$message.showLoading() |
| | | await this.refresh_category() |
| | | this.$message.hideLoading() |
| | | } else { |
| | | |
| | | } |
| | | |
| | | }, |
| | | async refresh_category() { |
| | | // this.columns_params = [] |
| | | this.dto.params = [] |
| | |
| | | |
| | | }, |
| | | computed: { |
| | | ...mapState(['currentInfo']) |
| | | ...mapState(['currentInfo']), |
| | | paramstr() { |
| | | if (this.dto && this.dto.params) { |
| | | var strs = [] |
| | | for (var i of this.dto.params) { |
| | | if (i.value) { |
| | | strs.push(i.value) |
| | | } |
| | | } |
| | | return strs.join(',') |
| | | } |
| | | return '' |
| | | } |
| | | }, |
| | | components: { |
| | | |
| | | dying318picker |
| | | } |
| | | } |
| | | </script> |