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

View File

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

View File

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

View File

@ -57,7 +57,8 @@
<video :src="addGoodsSecoundData.video_link"></video> <video :src="addGoodsSecoundData.video_link"></video>
<!--#endif--> <!--#endif-->
<!--#ifdef APP-PLUS--> <!--#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--> <!--#endif-->
<image src="../static/images/close.png" mode="widthFix"></image> <image src="../static/images/close.png" mode="widthFix"></image>
</view> </view>
@ -154,7 +155,7 @@
data() { data() {
return { return {
showComponent: false, showComponent: false,
showVideo:false, showVideo: false,
disModel: false, disModel: false,
upload_max: 10, upload_max: 10,
uploadUrl: `${HTTP_REQUEST_URL}/api/upload/video`, uploadUrl: `${HTTP_REQUEST_URL}/api/upload/video`,
@ -241,7 +242,7 @@
submitCreatedGoods() { submitCreatedGoods() {
Loading(); Loading();
let waitDeleteData = ['addGoodsFormData', 'singleSpecification', 'attrValue', 'modifyPriceData', 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')] : let attrValue = getStorage('addGoodsFormData').spec_type == 0 ? [getStorage('singleSpecification')] :
getStorage('attrValue'); getStorage('attrValue');
@ -254,12 +255,25 @@
}, },
video_link: this.addGoodsSecoundData.video_link video_link: this.addGoodsSecoundData.video_link
}; };
if (attrValue) {
if(attrValue){
postData.attrValue = attrValue.filter(item => item != ''); postData.attrValue = attrValue.filter(item => item != '');
postData.attrValue[0].bar_code 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) { if (getStorage('addGoodsFormData').spec_type == 0) {
// postData.attr = [getStorage('singleSpecification')]; // postData.attr = [getStorage('singleSpecification')];
} }
@ -419,6 +433,7 @@
} }
} }
} }
.videoHover { .videoHover {
width: 180rpx; width: 180rpx;
height: 180rpx; height: 180rpx;
@ -445,6 +460,7 @@
} }
} }
} }
.photo { .photo {
border: 1px solid #dddddd; border: 1px solid #dddddd;
opacity: 1; opacity: 1;
@ -487,10 +503,12 @@
height: 150rpx; height: 150rpx;
} }
} }
.preview_video{
.preview_video {
position: absolute; position: absolute;
} }
.container_input { .container_input {
background: #fff; background: #fff;
padding: 0 20rpx; padding: 0 20rpx;
@ -609,6 +627,7 @@
.marginTop_none { .marginTop_none {
margin-top: 0; margin-top: 0;
} }
.video-count { .video-count {
position: fixed; position: fixed;
width: 600rpx; width: 600rpx;
@ -627,6 +646,7 @@
height: 500rpx; height: 500rpx;
} }
} }
// .writeBg { // .writeBg {
// background: #fff; // background: #fff;
// } // }

View File

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