|
@@ -15,7 +15,7 @@
|
|
|
<view class="label">
|
|
<view class="label">
|
|
|
商品分类<span>*</span>
|
|
商品分类<span>*</span>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="picker" @click="isSelectType = true">
|
|
|
|
|
|
|
+ <view class="picker" @click="selectProductType">
|
|
|
<span v-if="showText == ''">选择商品分类</span>
|
|
<span v-if="showText == ''">选择商品分类</span>
|
|
|
<span v-else style="color: #333333;">{{showText}}</span>
|
|
<span v-else style="color: #333333;">{{showText}}</span>
|
|
|
<u-icon name="arrow-right"></u-icon>
|
|
<u-icon name="arrow-right"></u-icon>
|
|
@@ -36,7 +36,7 @@
|
|
|
<view class="tips">
|
|
<view class="tips">
|
|
|
支持jpg、png格式,尺寸为00px*00px
|
|
支持jpg、png格式,尺寸为00px*00px
|
|
|
</view>
|
|
</view>
|
|
|
- <u-upload ref="uUpload" :action="action" :file-list="fileList" max-count="1" width="140rpx"
|
|
|
|
|
|
|
+ <u-upload ref="uUpload" :action="action" :file-list="fmImageList" max-count="1" width="140rpx"
|
|
|
height="140rpx"></u-upload>
|
|
height="140rpx"></u-upload>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="item upload">
|
|
<view class="item upload">
|
|
@@ -46,7 +46,8 @@
|
|
|
<view class="tips">
|
|
<view class="tips">
|
|
|
支持jpg、png格式,尺寸为00px*00px,最多20张
|
|
支持jpg、png格式,尺寸为00px*00px,最多20张
|
|
|
</view>
|
|
</view>
|
|
|
- <u-upload :action="action" :file-list="fileList" max-count="20" width="140rpx" height="140rpx"></u-upload>
|
|
|
|
|
|
|
+ <u-upload ref="dUpload" :action="action" :file-list="xqImage" max-count="20" width="140rpx"
|
|
|
|
|
+ height="140rpx"></u-upload>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="item">
|
|
<view class="item">
|
|
|
<view class="label">
|
|
<view class="label">
|
|
@@ -80,34 +81,6 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <!-- <u-form :model="form" ref="uForm" v-if="schedule ==1"
|
|
|
|
|
- style="background-color: #fff;padding: 16rpx;border-radius: 16rpx;">
|
|
|
|
|
- <view class="titl">
|
|
|
|
|
- 基础信息
|
|
|
|
|
- </view>
|
|
|
|
|
- <u-form-item style="display: flex;">
|
|
|
|
|
- <label>
|
|
|
|
|
- 商品分类 <span style="color: red;">*</span>
|
|
|
|
|
- </label>
|
|
|
|
|
- <picker v-model="form.sex" :range="genderOptions" range-key="label" @change="onGenderChange">
|
|
|
|
|
- <view class="">{{ form.sex || '请选择分类' }}</view>
|
|
|
|
|
- </picker>
|
|
|
|
|
- </u-form-item>
|
|
|
|
|
- <u-form-item label="商品名称" label-width="200"><u-input v-model="form.intro" /></u-form-item>
|
|
|
|
|
- <u-form-item label="商品封面图" label-width="200">
|
|
|
|
|
- <u-upload :action="action" :file-list="fileList"></u-upload>
|
|
|
|
|
- </u-form-item>
|
|
|
|
|
- <u-form-item label="商品详情图" label-width="200">
|
|
|
|
|
- <u-upload :action="action" :file-list="fileList"></u-upload>
|
|
|
|
|
- </u-form-item>
|
|
|
|
|
- <u-form-item label="原价" label-width="200"><u-input v-model="form.intro" /></u-form-item>
|
|
|
|
|
- <u-form-item label="实际售价" label-width="200"><u-input v-model="form.intro" /></u-form-item>
|
|
|
|
|
- <u-form-item label="组合套餐" label-width="200">
|
|
|
|
|
- <view class="" @click="goGroup">
|
|
|
|
|
- 设置组合套餐
|
|
|
|
|
- </view>
|
|
|
|
|
- </u-form-item>
|
|
|
|
|
- </u-form> -->
|
|
|
|
|
<view class="form" v-if="schedule == 2">
|
|
<view class="form" v-if="schedule == 2">
|
|
|
<view class="titl ">
|
|
<view class="titl ">
|
|
|
售卖/使用信息
|
|
售卖/使用信息
|
|
@@ -150,9 +123,14 @@
|
|
|
<view class="label">
|
|
<view class="label">
|
|
|
退款规则
|
|
退款规则
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="picker set">
|
|
|
|
|
- 请选择
|
|
|
|
|
- <u-icon name="arrow-right" style="margin-left: 17rpx;"></u-icon>
|
|
|
|
|
|
|
+ <view class="picker set" @click="isRefund = true">
|
|
|
|
|
+ <view class="" v-if="showRule" style="color: #333333;">
|
|
|
|
|
+ {{showRule}}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="" v-else>
|
|
|
|
|
+ 请选择
|
|
|
|
|
+ <u-icon name="arrow-right" style="margin-left: 17rpx;"></u-icon>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="item upload">
|
|
<view class="item upload">
|
|
@@ -181,8 +159,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <selectDate @confirm="handleConfirm" @close="closeSelectDate" v-if="isSelectDate" />
|
|
|
|
|
- <refund v-if="isRefund" saveRule="saveFound" @closeRule="cutRule" />
|
|
|
|
|
|
|
+ <DateSelector @confirm="handleConfirm" @close="closeSelectDate" v-if="isSelectDate" />
|
|
|
|
|
+ <refund v-if="isRefund" @confirm="saveFound" @close="cutRule" />
|
|
|
<view class="popup" v-if="isSelectType">
|
|
<view class="popup" v-if="isSelectType">
|
|
|
<view class="model">
|
|
<view class="model">
|
|
|
<view class="title">
|
|
<view class="title">
|
|
@@ -220,87 +198,117 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import selectDate from '@/components/product/select_date.vue'
|
|
|
|
|
- import refund from '@/components/refund.vue'
|
|
|
|
|
|
|
+ // import DateSelector from '@/components/product/select_date.vue'
|
|
|
|
|
+ import refund from '@/components/product/refund.vue'
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
- selectDate,
|
|
|
|
|
|
|
+ // DateSelector,
|
|
|
refund
|
|
refund
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
form: {
|
|
form: {
|
|
|
- productName: '',
|
|
|
|
|
- productImage: '',
|
|
|
|
|
- intro: '',
|
|
|
|
|
- sex: '',
|
|
|
|
|
- checked: false,
|
|
|
|
|
- num: 0
|
|
|
|
|
|
|
+ // categoryId:'',
|
|
|
|
|
+ // productName: '',
|
|
|
|
|
+ // productImage: '',
|
|
|
|
|
+ // checked: null,
|
|
|
|
|
+ // num: 0,
|
|
|
|
|
+ // refundLabel:null,
|
|
|
|
|
+ // refundConfirm:null
|
|
|
},
|
|
},
|
|
|
|
|
+ fmImageList: [], //封面图
|
|
|
|
|
+ xqImage: [], //详情图
|
|
|
|
|
+ showRule: '', //显示退款规则文字
|
|
|
action: 'http://192.168.0.52:8080/jeecg-boot/sys/common/upload', //图片上传地址
|
|
action: 'http://192.168.0.52:8080/jeecg-boot/sys/common/upload', //图片上传地址
|
|
|
- checkboxList: [{
|
|
|
|
|
- name: '苹果',
|
|
|
|
|
- checked: false,
|
|
|
|
|
- disabled: false
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: '雪梨',
|
|
|
|
|
- checked: false,
|
|
|
|
|
- disabled: false
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: '柠檬',
|
|
|
|
|
- checked: false,
|
|
|
|
|
- disabled: false
|
|
|
|
|
- }
|
|
|
|
|
- ],
|
|
|
|
|
- genderOptions: [{
|
|
|
|
|
- label: '男',
|
|
|
|
|
- value: 'male'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '女',
|
|
|
|
|
- value: 'female'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '其他',
|
|
|
|
|
- value: 'other'
|
|
|
|
|
- }
|
|
|
|
|
- ],
|
|
|
|
|
schedule: 1, //进度
|
|
schedule: 1, //进度
|
|
|
fileList: [],
|
|
fileList: [],
|
|
|
selectedTime: null,
|
|
selectedTime: null,
|
|
|
isSelectDate: false,
|
|
isSelectDate: false,
|
|
|
isRefund: false,
|
|
isRefund: false,
|
|
|
- selectedRules: null,
|
|
|
|
|
isSelectType: false,
|
|
isSelectType: false,
|
|
|
treeLeft: [], //一级列表
|
|
treeLeft: [], //一级列表
|
|
|
treeCenter: [], //二级列表
|
|
treeCenter: [], //二级列表
|
|
|
treeRight: [], //三级列表
|
|
treeRight: [], //三级列表
|
|
|
- currentLeft: null, //一级选中
|
|
|
|
|
- currentCenter: null, //二级选中
|
|
|
|
|
- currentRight: null, //三级选中
|
|
|
|
|
|
|
+ currentLeft: 0, //一级选中
|
|
|
|
|
+ currentCenter: 0, //二级选中
|
|
|
|
|
+ currentRight: 0, //三级选中
|
|
|
productType: [], //选中的商品分类id
|
|
productType: [], //选中的商品分类id
|
|
|
selectTypeList: [], //选中的商品分类名称
|
|
selectTypeList: [], //选中的商品分类名称
|
|
|
showText: ''
|
|
showText: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- onGenderChange(event) {
|
|
|
|
|
- const selectedIndex = event.detail.value;
|
|
|
|
|
- this.form.sex = this.genderOptions[selectedIndex].label;
|
|
|
|
|
- this.selectedGenderLabel = this.genderOptions[selectedIndex].label;
|
|
|
|
|
- },
|
|
|
|
|
//下一步
|
|
//下一步
|
|
|
next() {
|
|
next() {
|
|
|
- this.schedule += 1
|
|
|
|
|
- let files = [];
|
|
|
|
|
- // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
|
|
|
|
|
- files = this.$refs.uUpload.lists.filter(val => {
|
|
|
|
|
- return val.progress == 100;
|
|
|
|
|
- })
|
|
|
|
|
- this.form.productImage = files[0].response.message
|
|
|
|
|
- console.log(this.form.productImage)
|
|
|
|
|
|
|
+ //封面图处理
|
|
|
|
|
+ if (this.$refs.uUpload.lists.length > 0) {
|
|
|
|
|
+ let files = [];
|
|
|
|
|
+ // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
|
|
|
|
|
+ files = this.$refs.uUpload.lists.filter(val => {
|
|
|
|
|
+ return val.progress == 100;
|
|
|
|
|
+ })
|
|
|
|
|
+ this.form.productImage = files[0].response.message
|
|
|
|
|
+ }
|
|
|
|
|
+ // 详情图处理
|
|
|
|
|
+ if (this.$refs.dUpload.lists.length > 0) {
|
|
|
|
|
+ let files = [];
|
|
|
|
|
+ // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
|
|
|
|
|
+ files = this.$refs.dUpload.lists.filter(val => {
|
|
|
|
|
+ return val.progress == 100;
|
|
|
|
|
+ })
|
|
|
|
|
+ let temp = []
|
|
|
|
|
+ files.map(item => {
|
|
|
|
|
+ temp.push(item.response.message)
|
|
|
|
|
+ })
|
|
|
|
|
+ this.form.detailImages = temp.join(',')
|
|
|
|
|
+ }
|
|
|
|
|
+ //基础信息必填提示
|
|
|
|
|
+ console.log(this.form)
|
|
|
|
|
+ if (!this.form.categoryId) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请选择商品分类',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.form.productName) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请输入商品名称',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.form.productImage) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请上传商品封面图',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.form.detailImages) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请上传商品详情图',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.form.price) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请输入商品原价',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.form.detailImages) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请输入商品售价',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.schedule += 1
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
// 跳转至组合商品页
|
|
// 跳转至组合商品页
|
|
|
goGroup() {
|
|
goGroup() {
|
|
@@ -336,9 +344,17 @@
|
|
|
url: '/pages/product/rule'
|
|
url: '/pages/product/rule'
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ // 保存退款规则
|
|
|
saveFound(rules) {
|
|
saveFound(rules) {
|
|
|
- this.selectedRules = rules; // 保存退款规则
|
|
|
|
|
- this.selectedRules = false
|
|
|
|
|
|
|
+ console.log(rules)
|
|
|
|
|
+ this.form.refundConfirm = rules.refundConfirm.refundConfirm
|
|
|
|
|
+ this.form.refundLabel = rules.refundLabel.refundLabel
|
|
|
|
|
+ let value1 = []
|
|
|
|
|
+ value1.push(rules.refundConfirm.name, rules.refundLabel.name)
|
|
|
|
|
+ this.showRule = value1.join("·")
|
|
|
|
|
+ // console.log(this.showRule)
|
|
|
|
|
+ // this.selectedRules = rules;
|
|
|
|
|
+ this.isRefund = false
|
|
|
},
|
|
},
|
|
|
cutRule() {
|
|
cutRule() {
|
|
|
this.isRefund = false
|
|
this.isRefund = false
|
|
@@ -360,7 +376,7 @@
|
|
|
if (res.data.code == 0) {
|
|
if (res.data.code == 0) {
|
|
|
this.treeCenter = res.data.result
|
|
this.treeCenter = res.data.result
|
|
|
if (this.treeCenter[0]) {
|
|
if (this.treeCenter[0]) {
|
|
|
- this.getRightTree(this.treeCenter[0].id)
|
|
|
|
|
|
|
+ // this.getRightTree(this.treeCenter[0].id)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -373,28 +389,47 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- //选中一级
|
|
|
|
|
- selectLeft(item, index) {
|
|
|
|
|
|
|
+ selectProductType() {
|
|
|
|
|
+ this.isSelectType = true
|
|
|
this.showText = ''
|
|
this.showText = ''
|
|
|
this.productType = []
|
|
this.productType = []
|
|
|
this.selectTypeList = []
|
|
this.selectTypeList = []
|
|
|
|
|
+ this.currentLeft = null
|
|
|
|
|
+ this.currentCenter = null
|
|
|
|
|
+ this.currentRight = null
|
|
|
|
|
+ },
|
|
|
|
|
+ //选中一级
|
|
|
|
|
+ selectLeft(item, index) {
|
|
|
this.currentLeft = index
|
|
this.currentLeft = index
|
|
|
this.currentCenter = null
|
|
this.currentCenter = null
|
|
|
this.currentRight = null
|
|
this.currentRight = null
|
|
|
|
|
+ this.treeCenter = []
|
|
|
|
|
+ this.treeRight = []
|
|
|
|
|
+ this.productType = []
|
|
|
|
|
+ this.selectTypeList = []
|
|
|
this.productType.push(item.id)
|
|
this.productType.push(item.id)
|
|
|
this.selectTypeList.push(item.name)
|
|
this.selectTypeList.push(item.name)
|
|
|
this.getCenterTree(item.id)
|
|
this.getCenterTree(item.id)
|
|
|
},
|
|
},
|
|
|
//选中二级
|
|
//选中二级
|
|
|
selectRight(item, index) {
|
|
selectRight(item, index) {
|
|
|
|
|
+ this.getRightTree(this.treeCenter[0].id)
|
|
|
this.currentCenter = index
|
|
this.currentCenter = index
|
|
|
this.currentRight = null
|
|
this.currentRight = null
|
|
|
|
|
+ if (this.selectTypeList.length >= 2) {
|
|
|
|
|
+ this.productType.splice(1, 2)
|
|
|
|
|
+ this.selectTypeList.splice(1, 2)
|
|
|
|
|
+ }
|
|
|
this.productType.push(item.id)
|
|
this.productType.push(item.id)
|
|
|
this.selectTypeList.push(item.name)
|
|
this.selectTypeList.push(item.name)
|
|
|
this.getRightTree(item.id)
|
|
this.getRightTree(item.id)
|
|
|
},
|
|
},
|
|
|
//选中三级
|
|
//选中三级
|
|
|
selectLast(item, index) {
|
|
selectLast(item, index) {
|
|
|
|
|
+ if (this.selectTypeList.length >= 3) {
|
|
|
|
|
+ this.productType.splice(2, 1)
|
|
|
|
|
+ this.selectTypeList.splice(2, 1)
|
|
|
|
|
+ }
|
|
|
this.productType.push(item.id)
|
|
this.productType.push(item.id)
|
|
|
this.selectTypeList.push(item.name)
|
|
this.selectTypeList.push(item.name)
|
|
|
this.currentRight = index
|
|
this.currentRight = index
|
|
@@ -402,6 +437,7 @@
|
|
|
//确定分类
|
|
//确定分类
|
|
|
selectType() {
|
|
selectType() {
|
|
|
this.isSelectType = false
|
|
this.isSelectType = false
|
|
|
|
|
+ this.form.categoryId = this.productType.join(',')
|
|
|
this.showText = this.selectTypeList.join('·')
|
|
this.showText = this.selectTypeList.join('·')
|
|
|
},
|
|
},
|
|
|
//关闭选择分类弹窗
|
|
//关闭选择分类弹窗
|
|
@@ -411,6 +447,16 @@
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.getLeftTree()
|
|
this.getLeftTree()
|
|
|
|
|
+ },
|
|
|
|
|
+ onLoad(options) {
|
|
|
|
|
+ if (options.data) {
|
|
|
|
|
+ let objStr = decodeURIComponent(options.data); // 获取并解码参数
|
|
|
|
|
+ let obj = JSON.parse(objStr); // 将字符串转换回对象
|
|
|
|
|
+
|
|
|
|
|
+ this.form.productGroups = obj
|
|
|
|
|
+ console.log(this.form.productGroups);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
@@ -457,6 +503,7 @@
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
flex: 1;
|
|
flex: 1;
|
|
|
padding: 24rpx;
|
|
padding: 24rpx;
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
|
|
|
.titl {
|
|
.titl {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -630,7 +677,7 @@
|
|
|
|
|
|
|
|
.tree {
|
|
.tree {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- max-height: 546rpx;
|
|
|
|
|
|
|
+ height: 546rpx;
|
|
|
|
|
|
|
|
.left {
|
|
.left {
|
|
|
overflow-y: auto;
|
|
overflow-y: auto;
|