修复bug

This commit is contained in:
weipengfei 2023-09-28 11:18:19 +08:00
parent 124fbeefca
commit 61049a01dc
5 changed files with 1146 additions and 1073 deletions

View File

@ -2,7 +2,7 @@
<view class=" writeBg ">
<view class="content_list">
<view class="content_list_item" @click="inputGoodsDetils">
<view class="content_list_item">
<view>商品详情</view>
<!-- <view class="content_list_item_han">
<span v-if="disModel" style="color: #000000">去修改</span>
@ -73,13 +73,13 @@
<span>开启后此商品只能在分销礼包中展示并销售</span>
</view> -->
<view class="container_input marginTop_none input-goods-detils">
<view class="container_input_item">
<!-- <view class="container_input_item">
<view class="container_input_item_label"><span>限购数量</span></view>
<view class="container_input_item_value">
<input v-model="addGoodsSecoundData.once_count" type="number" value="" placeholder="请输入限购数量"
placeholder-class="inputPlaceHolder" />
</view>
</view>
</view> -->
<view class="container_input_item">
<view class="container_input_item_label"><span>商品排序</span></view>
<view class="container_input_item_value">
@ -140,6 +140,10 @@
type: [String, Number],
default: ''
},
showCommodity: {
type: Boolean,
default: false
},
resetKey: {
type: Boolean,
default: false
@ -162,22 +166,26 @@
once_count: '', //
video_link: ''
},
goodsDis: {imageList: []},
goodsDis: {imageList: [],store_name:""},
store_name:'',
moreThanFlag: true,
};
},
created() {
// console.log('123');
mounted() {
this.initData();
// this.$nextTick(()=>{
// this.initData();
// })
},
updated() {
// this.initData();
},
watch: {
addGoodsSecoundData: {
handler(val) {
setTimeout(() => {
setStorage(this.product_id ? 'editGoodsDetils' : 'addGoodsSecoundData', val)
setStorage('editCommodity', val)
});
},
deep: true
@ -214,12 +222,21 @@
this.disModel = true;
}
if (this.product_id) {
editGoodsDetils = getStorage('editGoodsDetils');
// editGoodsDetils = getStorage('editGoodsDetils');
editGoodsDetils = this.$store.state.storage.storage;
console.log(editGoodsDetils);
// editGoodsDetils = getStorage('editGoodsDetils');
// console.log('',editGoodsDetils);
Object.keys(this.addGoodsSecoundData).forEach(item => {
console.log(item, editGoodsDetils[item]);
this.addGoodsSecoundData[item] = editGoodsDetils[item];
});
if (editGoodsDetils.content) {
this.goodsDis.imageList = editGoodsDetils.content.image;
this.goodsDis.store_name = editGoodsDetils.content.title;
this.store_name = editGoodsDetils.content.title;
// console.log(this.goodsDis, editGoodsDetils.content);
setStorage('goodsDis', {
store_name: editGoodsDetils.content.title,
imageList: editGoodsDetils.content.image
@ -228,6 +245,11 @@
}
setStorage('canChangeSecound', true);
return;
}else {
setStorage('goodsDis', {
store_name: '',
imageList: []
});
}
if (getStorage('addGoodsSecoundData')) {
@ -236,10 +258,6 @@
this.addGoodsSecoundData[item] = getStorage('addGoodsSecoundData')[item];
}
});
}
},
lastStep() {
@ -514,7 +532,7 @@
border-radius: 50%;
padding: 8rpx;
background: #e93323;
z-index: 999;
z-index: 2;
}
video {

View File

@ -9,8 +9,8 @@
placeholder-class="inputPlaceHolder" />
</view>
<view class="input_content_textarea">
<textarea v-model="setFormData.store_name" placeholder="请输入商品名称"
placeholder-class="placeholderStyle" maxlength="60" />
<textarea v-model="setFormData.store_name" placeholder="请输入商品名称" placeholder-class="placeholderStyle"
maxlength="60" />
<view>
<text v-if="setFormData.store_name">{{ setFormData.store_name.length }}</text>
<text v-else>0</text>
@ -20,15 +20,13 @@
<view class="photo_count">
<text class="photo_size">建议图片尺寸为750*750px</text>
<view class="input_content_photo">
<view class="input_content_photo_adPh" v-for="(item, index) in setFormData.imageList"
:key="index">
<view class="input_content_photo_adPh" v-for="(item, index) in setFormData.imageList" :key="index">
<image :src="item" class="myimg2 photos" @click="pop(item)"></image>
<view class="input_content_photo_adPh_jiao" @click="deleteImage(index)">
<image src="../static/images/close.png" mode=""></image>
</view>
</view>
<view v-if="setFormData.imageList.length < 9" class="input_content_photo_adPh addBtn"
@click="clk">
<view v-if="setFormData.imageList.length < 9" class="input_content_photo_adPh addBtn" @click="clk">
<view>
<image src="../static/images/creamer.png" mode="widthFix"></image>
</view>
@ -86,7 +84,7 @@
</view>
</view>
<priceComponent></priceComponent>
<priceComponent :product_id="product_id" v-if="showCommodity"></priceComponent>
<!-- <view class="popup_group">
<view class="radio">
@ -165,7 +163,8 @@
</view> -->
</view>
<commodityComponent :resetKey="secoundModel" :product_id="product_id" :merId="merId" :code="code" @lastStep="lastStep">
<commodityComponent v-if="showCommodity" :key="showCommodity" :showCommodity="showCommodity" :resetKey="secoundModel" :product_id="product_id" :merId="merId"
:code="code" @lastStep="lastStep">
</commodityComponent>
<view class="popup_group">
@ -245,9 +244,8 @@
<uni-popup ref="tempId" type="bottom">
<linkage-assembly selectProductTitle="选择运费模板" :form="setFormData" :classifiedData="classified['temp_id']"
:selectProductItem="productItem" :mer_id="merId" @getLinkageData="getTempIdData"
@multipleList="multipleList" @close="$refs.tempId.close()"
@scrolltolower="scrolltolower"></linkage-assembly>
:selectProductItem="productItem" :mer_id="merId" @getLinkageData="getTempIdData" @multipleList="multipleList"
@close="$refs.tempId.close()" @scrolltolower="scrolltolower"></linkage-assembly>
</uni-popup>
<uni-popup ref="attr" type="bottom">
<attr @close="$refs.attr.close()" :mer_id="merId" :attrList="classified['attr']" @selectAttr="selectAttr">
@ -307,6 +305,7 @@
},
data() {
return {
showCommodity: false, // ,
step: 1,
bar_code: '',
bar_code_dis: false,
@ -330,7 +329,7 @@
specifica: '', //
setSpecificaValue: '', //
setSpecificaValue2: '',
delivery_way: [1,2], // 1 2
delivery_way: [1, 2], // 1 2
delivery_free: '1', // 0 1
temp_id: '', // ID
tempName: '' //
@ -429,6 +428,7 @@
// console.log(opt);
this.merId = Number(opt.mer_id);
this.product_id = opt.product_id;
if(!opt.product_id)this.showCommodity=true;
if (opt.code) {
this.code = opt.code;
this.bar_code_dis = true
@ -439,6 +439,16 @@
this.initDataEditData();
}
},
onBackPress() {
let waitDeleteData = ['addGoodsFormData', 'singleSpecification', 'attrValue', 'modifyPriceData',
'addGoodsSecoundData', 'goodsDis', 'editGoodsDetils', 'canChange', 'canChangeSecound', 'editCommodity'
];
waitDeleteData.forEach(item => {
if (getStorage(item)) {
removeStorage(item);
}
});
},
onShow() {
this.setFormData.setSpecificaValue = '';
this.setFormData.setSpecificaValue2 = '';
@ -480,6 +490,7 @@
}
},
methods: {
//
pop(e) {
this.show = true
@ -573,6 +584,7 @@
}
productDetail(this.merId, this.product_id).then(res => {
setStorage('editGoodsDetils', res.data);
this.$store.commit('setStorage', res.data);
let editGoodsDetils = res.data;
Object.keys(this.setFormData).forEach(item => {
this.setFormData[item] = editGoodsDetils[item];
@ -606,6 +618,8 @@
editGoodsDetils.temp && (this.setFormData.tempName = editGoodsDetils.temp.name);
setStorage('canChange', true);
hideLoading();
this.showCommodity = true;
});
},
//
@ -856,7 +870,7 @@
handleNextStep() {
this.step = 2;
return ;
return;
// console.log(this.setFormData.setSpecificaValue)
let canJumpFlag = true;
let requireData = {
@ -915,10 +929,10 @@
.pop {
z-index: 1;
}
.guanbi {
width: 20px;
height: 20px;
margin: 30px auto;
}
</style>

View File

@ -1,7 +1,8 @@
<template>
<view class="container">
<select-form style="border-radius: 10rpx 10rpx 0 0;" :platformClassification="formList" :form="singleSpecification" @input="input"></select-form>
<view class="more_than" @click="moreThanFlag?selectMoreThan():spliceMoreThan()" >
<select-form style="border-radius: 10rpx 10rpx 0 0;" :platformClassification="formList" :form="singleSpecification"
@input="input"></select-form>
<view class="more_than" @click="moreThanFlag?selectMoreThan():spliceMoreThan()">
<view v-if="moreThanFlag">更多</view>
<view v-else>收起</view>
</view>
@ -18,14 +19,16 @@
import { navigateTo, navigateBack, serialize, setStorage, getStorage } from '../../../libs/uniApi.js';
// attrValue
export default {
components:{
components: {
selectForm
},
props: ['product_id'],
data() {
return {
singleSpecification: {
price: '', //
cost: '', //
stock: '', //
ot_price: '', //
bar_code: '', //
weight: '', //
@ -35,24 +38,14 @@
extension_two: ''
},
moreThanFlag: true,
formList: [
{
formList: [{
id: 1,
label: '售价',
type: 'digit',
model: 'price',
holder: '请填写售价'
},
{
id: 0,
label: '库存',
type: 'digit',
model: 'stock_num',
holder: '请填写库存'
},
],
moreThanList: [
{
}],
moreThanList: [{
id: 2,
label: '成本价',
type: 'digit',
@ -137,6 +130,31 @@
// key: 'singleSpecification'
// });
// },
mounted() {
if (getStorage('addGoodsFormData').image) {
this.singleSpecification.image = getStorage('addGoodsFormData').image;
}
if (getStorage('singleSpecification')) {
Object.keys(this.singleSpecification).forEach(item => {
if (getStorage('singleSpecification')[item]) {
this.singleSpecification[item] = getStorage('singleSpecification')[item]
}
})
}
if (!this.$props.product_id) {
this.formList.push({
id: 10,
label: '库存',
type: 'digit',
model: 'stock',
holder: '请填写库存',
disable: true
})
}
},
destroyed() {
setStorage('singleSpecification', {});
},
methods: {
selectMoreThan() {
this.formList = this.formList.concat(this.moreThanList);
@ -144,7 +162,7 @@
},
spliceMoreThan() {
this.moreThanFlag = true;
this.formList.splice(2, this.formList.length);
this.formList.splice(!this.$props.product_id?2:1, this.formList.length);
},
input(val) {
this.singleSpecification = val
@ -162,6 +180,7 @@
.container {
padding: 0 !important;
}
.more_than {
background: #FFFFFF;
border-radius: 0 0 10rpx 10rpx;
@ -187,6 +206,7 @@
display: flex;
align-items: center;
justify-content: center;
.button {
display: flex;
align-items: center;

View File

@ -57,7 +57,8 @@
<video :src="addGoodsSecoundData.video_link"></video>
<!--#endif-->
<!--#ifdef APP-PLUS-->
<img src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/3/video_bg.png" style=" width:150rpx" ></img>
<img src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/3/video_bg.png"
style=" width:150rpx"></img>
<!--#endif-->
<image src="../static/images/close.png" mode="widthFix"></image>
</view>
@ -154,7 +155,7 @@
data() {
return {
showComponent: false,
showVideo:false,
showVideo: false,
disModel: false,
upload_max: 10,
uploadUrl: `${HTTP_REQUEST_URL}/api/upload/video`,
@ -241,7 +242,7 @@
submitCreatedGoods() {
Loading();
let waitDeleteData = ['addGoodsFormData', 'singleSpecification', 'attrValue', 'modifyPriceData',
'addGoodsSecoundData', 'goodsDis', 'editGoodsDetils', 'canChange', 'canChangeSecound'
'addGoodsSecoundData', 'goodsDis', 'editGoodsDetils', 'canChange', 'canChangeSecound', 'editCommodity'
];
let attrValue = getStorage('addGoodsFormData').spec_type == 0 ? [getStorage('singleSpecification')] :
getStorage('attrValue');
@ -254,12 +255,25 @@
},
video_link: this.addGoodsSecoundData.video_link
};
if(attrValue){
if (attrValue) {
postData.attrValue = attrValue.filter(item => item != '');
postData.attrValue[0].bar_code
}
// console.log(postData);
let info = getStorage('editCommodity');
Object.keys(info).forEach(key=>{
postData[key]=info[key];
})
postData.stock = postData.attrValue[0].stock;
console.log(postData);
if(postData.store_name.trim().length<=0)return Toast('请输入商品名称');
if(postData.imageList.length<=0)return Toast('请上传商品图片');
if(postData.cate_name.trim().length<=0)return Toast('请选择平台分类');
if(postData.unit_name.trim().length<=0)return Toast('请输入商品单位');
if(!postData.attrValue[0].price||postData.attrValue[0].price<0)return Toast('价格不能小于0');
if(!postData.stock||postData.stock<0)return Toast('库存不能小于0');
if(postData.content.title.trim().length<=0)return Toast('请输入商品详情');
if(postData.content.image.length<=0)return Toast('请上传商品图片');
// return Toast('');
if (getStorage('addGoodsFormData').spec_type == 0) {
// postData.attr = [getStorage('singleSpecification')];
}
@ -419,6 +433,7 @@
}
}
}
.videoHover {
width: 180rpx;
height: 180rpx;
@ -445,6 +460,7 @@
}
}
}
.photo {
border: 1px solid #dddddd;
opacity: 1;
@ -487,10 +503,12 @@
height: 150rpx;
}
}
.preview_video{
.preview_video {
position: absolute;
}
}
.container_input {
background: #fff;
padding: 0 20rpx;
@ -609,6 +627,7 @@
.marginTop_none {
margin-top: 0;
}
.video-count {
position: fixed;
width: 600rpx;
@ -627,6 +646,7 @@
height: 500rpx;
}
}
// .writeBg {
// background: #fff;
// }

View File

@ -31,7 +31,8 @@
<text v-else>0</text>/200
</view>
</view>
<view class="input_content_describe_textarea"><textarea v-model="prodectContent.store_info" value=""
<view class="input_content_describe_textarea">
<textarea v-model="prodectContent.store_info" value=""
placeholder="请填写商品简介" placeholderClass="placeholderClass" maxlength="200" /></view>
</view>
@ -110,7 +111,7 @@
}
},
mounted() {
console.log(this.$props.prodectContent);
},
methods: {
handleChooseImage() {