| | |
| | | </view>
|
| | | </view>
|
| | | <view class="form-item before-line">
|
| | | <view class="label required">商品名称</view>
|
| | | <view class="label">商品名称</view>
|
| | | <view class="m-l-a m-r-0 flex">
|
| | | <input v-model="dto.name" placeholder="请选择分类" disabled
|
| | | style="margin-top: 16px;text-align: right;"></input>
|
| | |
| | | </view>
|
| | | </view>
|
| | | <view class="form-item before-line">
|
| | | <view class="label required">商品单位</view>
|
| | | <view class="label">商品单位</view>
|
| | | <view class="m-l-a m-r-0 flex">
|
| | | <input v-model="dto.unit" placeholder="请选择分类" disabled
|
| | | style="margin-top: 16px;text-align: right;"></input>
|
| | |
| | | </view>
|
| | |
|
| | | <view class="form-item before-line">
|
| | | <view class="label required">商品颜色</view>
|
| | | <view class="label">商品颜色</view>
|
| | | <!-- <view class="m-l-a m-r-0 flex " :class="[!dto.color?'desc-gray':'']" @click="()=>{
|
| | | show_select_color=true
|
| | | }">
|
| | |
| | | </view>
|
| | |
|
| | | <view class="form-item before-line bottom-border-no">
|
| | | <view class="label required" style="width: 400rpx;">商品轮播图(300*160px)</view>
|
| | | <view class="label " style="width: 400rpx;">商品轮播图(300*160px)</view>
|
| | | <view class="m-l-a m-r-0 flex">
|
| | | <!-- :style="{'background-image':dto.icon&&`url('${dto.icon}')`||''}" -->
|
| | | <view class="component-button-upload" @click="uploadIcon('bannerList')">
|
| | |
| | | </view>
|
| | | </view>
|
| | | <view class="line-gray-big"></view>
|
| | | <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
|
| | | }">
|
| | | <view>{{dto.levelStr||dto.level || '请选择'}}</view>
|
| | | <u-icon class="m-l-a" name="arrow-right"></u-icon>
|
| | | </view>
|
| | |
|
| | | </view>
|
| | |
|
| | |
|
| | | <view class="form-item before-line">
|
| | |
| | |
|
| | | </view>
|
| | | <view class="line-gray-big"></view>
|
| | | <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
|
| | | }">
|
| | | <view>{{dto.levelStr||dto.level || '请选择'}}</view>
|
| | | <u-icon class="m-l-a" name="arrow-right"></u-icon>
|
| | | </view>
|
| | |
|
| | | </view>
|
| | |
|
| | |
|
| | | <view class="form-item before-line">
|
| | | <view class="label required">商品视频</view>
|
| | | <view class="label">商品视频</view>
|
| | | <view class="m-l-a m-r-0 flex">
|
| | | <!-- :style="{'background-image':dto.icon&&`url('${dto.icon}')`||''}" -->
|
| | | <view class="component-button-upload m-r-15" @click="uploadIcon('video')">
|
| | |
| | | <view v-if="dto.video">
|
| | | <video :src="dto.video" style="display: block;margin: 0 auto;"></video>
|
| | | </view>
|
| | | <view class="form-item ">
|
| | | <view class="label required">商品描述</view>
|
| | | <view class="m-l-a m-r-0 flex">
|
| | | <!-- <u-input type="textarea" v-model="dto.description" placeholder="请输入商品描述" type="number"
|
| | | ></u-input> -->
|
| | | <u--textarea v-model="dto.description" style="margin-top: 16px;text-align: right;"
|
| | | placeholder="请输入商品描述"></u--textarea>
|
| | |
|
| | | </view>
|
| | | </view>
|
| | |
|
| | |
|
| | |
|
| | | <view style="min-height: 200rpx;">
|
| | |
|
| | |
| | | :columns="columns_levels"></u-picker>
|
| | |
|
| | |
|
| | | <uni-popup ref="popup_param" type="top">
|
| | | <view class="component-popup_input" v-if="dto.params">
|
| | | <uni-popup ref="popup_param" type="bottom">
|
| | | <view class="component-popup_input_all" v-if="dto.params">
|
| | | <view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">商品参数设置</view>
|
| | | <!-- 输入框-->
|
| | | <view v-for="(item,i) in dto.params" :key="i" class="m-b-20">
|
| | | <view class="title topic-font" style="font-size: 36rpx;font-weight: 600;">{{item.name}}</view>
|
| | | <view class="m-t-12">
|
| | | <u-radio-group v-model="item.value" placement="row">
|
| | | <u-radio
|
| | | :customStyle="{'margin-bottom': '16rpx','margin-right': '24rpx','font-size':'28rpx'}"
|
| | | v-for="(each, j) in item.values" :key="j" :label="each" :name="each">
|
| | | </u-radio>
|
| | | </u-radio-group>
|
| | | <view v-for="(item,i) in dto.params" :key="i" class="m-t-20">
|
| | | <view class="title topic-font" style="font-size: 40rpx;font-weight: 600;">{{item.name}}</view>
|
| | | <view class="m-t-12 flex value-items">
|
| | | <view class="value-item" @click="updateValue(item,each)" :class="[item.value===each?'cur':'']"
|
| | | v-for="(each, j) in item.values" :key="j">
|
| | | {{each || '-'}}
|
| | | </view>
|
| | | </view>
|
| | | </view>
|
| | |
|
| | | <!-- 提交按钮 -->
|
| | | <view class="button-green" @click="closeParamPop">返回</view>
|
| | | <view class="button-space"></view>
|
| | | <view class="button-green" @click="closeParamPop">确定</view>
|
| | | </view>
|
| | | </uni-popup>
|
| | | <!-- <dying318picker :picker-list="columns_categorys" ref="picker_category" @confirm="confirmPickerCategory">
|
| | | </dying318picker> -->
|
| | |
|
| | | </view>
|
| | | </template>
|
| | |
|
| | |
| | | bannerList: [], //str[]
|
| | | video: '',
|
| | | level: '', //FLOWER_LEVEL
|
| | | price: 0.00,
|
| | | stock: 0,
|
| | | price: '',
|
| | | stock: '',
|
| | | params: [], //id,value
|
| | | description: '',
|
| | | },
|
| | | requireFields: [{
|
| | | name: '商品分类',
|
| | | key: 'category'
|
| | | }, {
|
| | | name: '列表封面图',
|
| | | key: 'cover'
|
| | | }, {
|
| | | name: '商品等级',
|
| | | key: 'level'
|
| | | }, {
|
| | | name: '商品价格',
|
| | | key: 'price'
|
| | | }, {
|
| | | name: '商品库存',
|
| | | key: 'stock'
|
| | | }],
|
| | | show_select_category: false,
|
| | | show_select_level: false,
|
| | | columns_categorys: [],
|
| | |
| | | }).then(res => {
|
| | | var data = res.data
|
| | | this.columns_levels = [data || []]
|
| | | this.columns_levels[0].unshift({
|
| | | label: '全部',
|
| | | value: ''
|
| | | })
|
| | | // this.columns_levels[0].unshift({
|
| | | // label: '全部',
|
| | | // value: ''
|
| | | // })
|
| | |
|
| | | })
|
| | | if (options.id) {
|
| | |
| | | },
|
| | |
|
| | | methods: {
|
| | | updateValue(item, value) {
|
| | | item.value = value
|
| | | this.$set(item, 'value', value)
|
| | | this.$forceUpdate()
|
| | | console.log('updateValue')
|
| | | },
|
| | | async updateSearch(search) {
|
| | | this.columns_categorys_search = search || ''
|
| | | this.columns_categorys_picker = []
|
| | |
| | |
|
| | | },
|
| | | async submit() {
|
| | | if (!this.dto.price) {
|
| | | this.$message.showToast('商品价格未设置')
|
| | | return
|
| | | }
|
| | | var tmp = parseFloat(this.dto.price)
|
| | | if (isNaN(tmp) || ('' + tmp) !== ('' + this.dto.price)) {
|
| | | this.$message.showToast('商品价格格式错误,精确到分')
|
| | | return
|
| | | }
|
| | | if ((tmp.toFixed(2) + '' + '0') !== tmp.toFixed(3)) {
|
| | | this.$message.showToast('商品价格至多精确到分')
|
| | | // console.log('tmp.toFixed(2)',tmp.toFixed(2),tmp.toFixed(3))
|
| | | return
|
| | | } else {
|
| | | this.dto.price = this.dto.price.toFixed(2)
|
| | | }
|
| | | if (this.dto.price <= 0) {
|
| | | this.$message.showToast('商品价格不能小于等于0')
|
| | | return
|
| | | }
|
| | | tmp = parseFloat(this.dto.stock)
|
| | | if (isNaN(tmp) || ('' + tmp.toFixed(0)) !== ('' + this.dto.stock) || tmp < 0) {
|
| | | this.$message.showToast('商品库存格式错误,需要大于等于0')
|
| | | return
|
| | | }
|
| | |
|
| | | for (var field of this.requireFields) {
|
| | | if (!this.dto[field.key]) {
|
| | | this.$message.showToast(`${field.name}信息未填写`)
|
| | | return
|
| | | }
|
| | | }
|
| | | if (this.dto.params.length < 1) {
|
| | | this.$message.showToast('商品参数详情未设置')
|
| | | return
|
| | | } else {
|
| | | for (var item of this.dto.params) {
|
| | | if (!item.value) {
|
| | | this.$message.showToast('存在商品参数详情未设置')
|
| | | return
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // if (!this.dto.applicationType) {
|
| | | // this.$message.showToast('未选择类型')
|
| | | // return
|
| | |
| | | if (re.code == 2000 || re.code == 0) {
|
| | | this.$message.showToast('操作成功')
|
| | | //需要标记加一下
|
| | | // this.$store.dispatch('sign_add', 'application');
|
| | | this.$store.dispatch('sign_add', 'flower');
|
| | |
|
| | | this.backpage()
|
| | | } else {
|
| | | console.log('error re', re)
|
| | | if (re.code === 30000 && Array.isArray(re.msg)) {
|
| | | this.$message.showToast('字段未填写完整')
|
| | |
|
| | | }
|
| | | }
|
| | | },
|
| | | async deleteBanner(index) {
|
| | |
| | | const that = this
|
| | | if (key == 'video') {
|
| | | uni.chooseVideo({
|
| | | maxDuration: 30,
|
| | | sourceType: ['camera', 'album'],
|
| | | success: function(res) {
|
| | | // console.log('res',res)
|
| | | // size: 11082508
|
| | | if (res.size > 1024 * 1024 * 50) {
|
| | | that.$message.confirm('视频最多支持50M大小,超出大小限制')
|
| | | return
|
| | | }
|
| | | if (res.tempFilePath) {
|
| | | console.log('res.tempFilePath', res.tempFilePath)
|
| | | that.$message.showLoading()
|
| | |
| | | count: 1, // 最多可以选择的图片张数,默认9
|
| | | sizeType: ['compressed'], //original 原图,compressed 压缩图,默认二者都有
|
| | | sourceType: ['camera', 'album'], //album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项
|
| | | success: function({
|
| | | errMsg,
|
| | | tempFiles
|
| | | }) {
|
| | | success: function(res) {
|
| | | let errMsg = res.errMsg
|
| | | let tempFiles = res.tempFiles
|
| | | if (errMsg === 'chooseImage:ok') {
|
| | | // console.log(tempFiles[0])
|
| | | if (tempFiles[0].size > 1024 * 1024 * 5) {
|
| | | that.$message.confirm('图片最多支持5M大小,超出大小限制')
|
| | | return
|
| | | }
|
| | | that.$message.showLoading()
|
| | | that.$http.upload(tempFiles[0].path).then(async res => {
|
| | | console.log('res1', res)
|