修复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 {

File diff suppressed because it is too large Load Diff

View File

@ -1,202 +1,222 @@
<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()" >
<view v-if="moreThanFlag">更多</view>
<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()">
<view v-if="moreThanFlag">更多</view>
<view v-else>收起</view>
</view>
<!-- <view class="handle">
</view>
<!-- <view class="handle">
<view class="button" @click="saveSingleSpecification">
保存
</view>
</view> -->
</view>
</view>
</template>
<script>
import selectForm from '../components/selectForm.vue';
import { navigateTo, navigateBack, serialize, setStorage, getStorage } from '../../../libs/uniApi.js';
// attrValue
export default {
components:{
selectForm
},
data() {
return {
singleSpecification: {
price: '', //
cost: '', //
ot_price: '', //
bar_code: '', //
weight: '', //
volume: '', //
image: '',
extension_one: '',
extension_two: ''
},
moreThanFlag: true,
formList: [
{
id: 1,
label: '售价',
type: 'digit',
model: 'price',
holder: '请填写售价'
},
{
id: 0,
label: '库存',
type: 'digit',
model: 'stock_num',
holder: '请填写库存'
},
],
moreThanList: [
{
id: 2,
label: '成本价',
type: 'digit',
holder: '请填写成本价',
model: 'cost'
import selectForm from '../components/selectForm.vue';
import { navigateTo, navigateBack, serialize, setStorage, getStorage } from '../../../libs/uniApi.js';
// attrValue
export default {
components: {
selectForm
},
props: ['product_id'],
data() {
return {
singleSpecification: {
price: '', //
cost: '', //
stock: '', //
ot_price: '', //
bar_code: '', //
weight: '', //
volume: '', //
image: '',
extension_one: '',
extension_two: ''
},
moreThanFlag: true,
formList: [{
id: 1,
label: '售价',
type: 'digit',
model: 'price',
holder: '请填写售价'
}],
moreThanList: [{
id: 2,
label: '成本价',
type: 'digit',
holder: '请填写成本价',
model: 'cost'
},
{
id: 3,
label: '原价',
type: 'digit',
holder: '请填写原价',
model: 'ot_price'
id: 3,
label: '原价',
type: 'digit',
holder: '请填写原价',
model: 'ot_price'
},
{
id: 5,
label: '商品编号',
type: 'input',
holder: '请填写商品编号',
model: 'bar_code'
},
{
id: 6,
label: '重量',
type: 'digit',
holder: '请输入重量',
model: 'weight'
},
{
id: 7,
label: '体积',
type: 'digit',
holder: '请输入体积',
model: 'volume'
},
// {
// id: 8,
// label: '',
// type: 'digit',
// holder: '',
// model: 'extension_one'
// },
// {
// id: 9,
// label: '',
// type: 'digit',
// holder: '',
// model: 'extension_two'
// }
],
}
},
watch: {
singleSpecification: {
handler(val) {
this.singleSpecification = val;
{
id: 5,
label: '商品编号',
type: 'input',
holder: '请填写商品编号',
model: 'bar_code'
},
{
id: 6,
label: '重量',
type: 'digit',
holder: '请输入重量',
model: 'weight'
},
{
id: 7,
label: '体积',
type: 'digit',
holder: '请输入体积',
model: 'volume'
},
// {
// id: 8,
// label: '',
// type: 'digit',
// holder: '',
// model: 'extension_one'
// },
// {
// id: 9,
// label: '',
// type: 'digit',
// holder: '',
// model: 'extension_two'
// }
],
}
},
watch: {
singleSpecification: {
handler(val) {
this.singleSpecification = val;
this.saveSingleSpecification();
},
deep: true
}
},
// onLoad(option) {
// console.log(option);
// this.singleSpecification.bar_code=option.code
// },
// onShow() {
// 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]
// }
// })
// }
// },
// beforeDestroy() {
// console.log('123');
// uni.removeStorage({
// key: 'singleSpecification'
// });
// },
methods: {
selectMoreThan() {
this.formList = this.formList.concat(this.moreThanList);
this.moreThanFlag = false;
},
spliceMoreThan() {
this.moreThanFlag = true;
this.formList.splice(2, this.formList.length);
},
input(val) {
this.singleSpecification = val
},
//
saveSingleSpecification() {
setStorage('singleSpecification', this.singleSpecification);
// navigateBack(1);
}
}
}
},
deep: true
}
},
// onLoad(option) {
// console.log(option);
// this.singleSpecification.bar_code=option.code
// },
// onShow() {
// 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]
// }
// })
// }
// },
// beforeDestroy() {
// console.log('123');
// uni.removeStorage({
// 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);
this.moreThanFlag = false;
},
spliceMoreThan() {
this.moreThanFlag = true;
this.formList.splice(!this.$props.product_id?2:1, this.formList.length);
},
input(val) {
this.singleSpecification = val
},
//
saveSingleSpecification() {
setStorage('singleSpecification', this.singleSpecification);
// navigateBack(1);
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 0 !important;
}
.more_than {
background: #FFFFFF;
border-radius: 0 0 10rpx 10rpx;
margin: auto;
// margin-top: 30rpx;
margin-top: 1px;
display: flex;
align-items: center;
justify-content: center;
width: 710rpx;
height: 84rpx;
color: #333333;
font-size: 30rpx;
}
.handle {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 126rpx;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
.button {
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
font-size: 32rpx;
width: 690rpx;
height: 86rpx;
background: #E93323;
border-radius: 43rpx;
}
}
</style>
.container {
padding: 0 !important;
}
.more_than {
background: #FFFFFF;
border-radius: 0 0 10rpx 10rpx;
margin: auto;
// margin-top: 30rpx;
margin-top: 1px;
display: flex;
align-items: center;
justify-content: center;
width: 710rpx;
height: 84rpx;
color: #333333;
font-size: 30rpx;
}
.handle {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 126rpx;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
.button {
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
font-size: 32rpx;
width: 690rpx;
height: 86rpx;
background: #E93323;
border-radius: 43rpx;
}
}
</style>

View File

@ -50,41 +50,42 @@
<view class="content_list_video">
<view class="content_list_video_title">商品视频</view>
<view class="video_list">
<view class="video_list_item photo" v-if="addGoodsSecoundData.video_link">
<view class="video_list_item photo" v-if="addGoodsSecoundData.video_link">
<view class="jiao" @click="deleteImage()">
<!-- video标签在app端层级过高 -->
<!--#ifndef APP-PLUS-->
<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>
<!--#endif-->
<!-- video标签在app端层级过高 -->
<!--#ifndef APP-PLUS-->
<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>
<!--#endif-->
<image src="../static/images/close.png" mode="widthFix"></image>
</view>
<!--#ifndef APP-PLUS-->
<view style="position: absolute;">
<view class="videoHover" @click="videoshow">
</view>
<text class="video-text">点击可预览视频</text>
</view>
<!--#endif-->
<!--#ifdef APP-PLUS-->
<view class='preview_video'>
<view class="videoHover" @click="videoshow">
</view>
<text class="video-text">点击可预览视频</text>
</view>
<!--#endif-->
<!--#ifndef APP-PLUS-->
<view style="position: absolute;">
<view class="videoHover" @click="videoshow">
</view>
<text class="video-text">点击可预览视频</text>
</view>
<!--#endif-->
<!--#ifdef APP-PLUS-->
<view class='preview_video'>
<view class="videoHover" @click="videoshow">
</view>
<text class="video-text">点击可预览视频</text>
</view>
<!--#endif-->
</view>
<view class="photo" @click="uploadVideo" v-else>
<view>
<image src="../static/images/creamer.png" mode="widthFix"></image>
@ -93,18 +94,18 @@
</view>
</view>
</view>
</view>
<view v-if="showVideo" class="video-count">
<!--#ifndef APP-PLUS-->
<video id="myVideo" class="videoLink" autoplay loop muted :src="addGoodsSecoundData.video_link"></video>
<!--#endif-->
<!--#ifdef APP-PLUS-->
<video id="myVideo" class="videoLink" autoplay loop
:src='addGoodsSecoundData.video_link && (addGoodsSecoundData.video_link.substring(0,4) == "http" || addGoodsSecoundData.video_link.substring(0,5) == "https") ?addGoodsSecoundData.video_link : "http:" + addGoodsSecoundData.video_link'></video>
<!--#endif-->
</view>
<view class='mask' catchtouchmove="true" :hidden='showVideo==false' @tap="showVideo=false"></view>
</view>
<view v-if="showVideo" class="video-count">
<!--#ifndef APP-PLUS-->
<video id="myVideo" class="videoLink" autoplay loop muted :src="addGoodsSecoundData.video_link"></video>
<!--#endif-->
<!--#ifdef APP-PLUS-->
<video id="myVideo" class="videoLink" autoplay loop
:src='addGoodsSecoundData.video_link && (addGoodsSecoundData.video_link.substring(0,4) == "http" || addGoodsSecoundData.video_link.substring(0,5) == "https") ?addGoodsSecoundData.video_link : "http:" + addGoodsSecoundData.video_link'></video>
<!--#endif-->
</view>
<view class='mask' catchtouchmove="true" :hidden='showVideo==false' @tap="showVideo=false"></view>
<view class="handle dobuButton">
<view class="handle_button margin_right" @click="lastStep">上一步</view>
<view class="handle_button" @click="submitCreatedGoods">提交</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`,
@ -172,7 +173,7 @@
// console.log('123');
this.initData();
},
watch: {
addGoodsSecoundData: {
handler(val) {
@ -190,16 +191,16 @@
}
},
methods: {
videoshow() {
this.showVideo = true
this.videoContext = uni.createVideoContext('myVideo', this);
this.$nextTick(() => {
this.videoContext.play();
})
// this.video_link = this.formData.video_link;
// this.videoContext.requestFullScreen({ direction: 90 });
// this.videoContext.play(); this.videoplay = true;
},
videoshow() {
this.showVideo = true
this.videoContext = uni.createVideoContext('myVideo', this);
this.$nextTick(() => {
this.videoContext.play();
})
// this.video_link = this.formData.video_link;
// this.videoContext.requestFullScreen({ direction: 90 });
// this.videoContext.play(); this.videoplay = true;
},
initData() {
let editGoodsDetils = {};
if (getStorage('goodsDis')) {
@ -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){
postData.attrValue = attrValue.filter(item => item != '');
postData.attrValue[0].bar_code
}
// console.log(postData);
if (attrValue) {
postData.attrValue = attrValue.filter(item => item != '');
postData.attrValue[0].bar_code
}
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')];
}
@ -275,7 +289,7 @@
Modal('提交成功', '点击确定,返回商品管理', {
showCancel: false
}).then(() => {
uni.removeStorageSync('singleSpecification')
uni.removeStorageSync('singleSpecification')
uni.redirectTo({
url: '/pages/product/goodsOnSale/index?mer_id=' + this.merId
})
@ -328,8 +342,8 @@
uni.chooseVideo({
sourceType: ['camera', 'album'],
success: res => {
console.log(res)
console.log(res)
if (Math.ceil(res.size / 1024) < this.upload_max * 1024) {
uni.uploadFile({
url: this.uploadUrl, //
@ -361,11 +375,11 @@
}
},
fail: err => {
//
//
// uni.showModal({
// content: JSON.stringify(err)
// });
console.log(err)
console.log(err)
}
});
},
@ -419,32 +433,34 @@
}
}
}
.videoHover {
width: 180rpx;
height: 180rpx;
.videoHover {
width: 180rpx;
height: 180rpx;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
z-index: 10;
view {
width: 50rpx;
height: 50rpx;
background: #000000;
border-radius: 50rpx;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
z-index: 10;
view {
width: 50rpx;
height: 50rpx;
background: #000000;
border-radius: 50rpx;
display: flex;
align-items: center;
justify-content: center;
.iconfont {
color: #ffffff;
font-size: 21rpx;
}
.iconfont {
color: #ffffff;
font-size: 21rpx;
}
}
}
.photo {
border: 1px solid #dddddd;
opacity: 1;
@ -487,10 +503,12 @@
height: 150rpx;
}
}
.preview_video{
position: absolute;
}
.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() {