商品详情修改

This commit is contained in:
zmj 2024-04-25 08:40:17 +08:00
parent 6dff85d544
commit 1a01e1ae65
7 changed files with 646 additions and 88 deletions

View File

@ -1,47 +1,44 @@
<template>
<view class='product-bg'>
<swiper :indicator-dots="indicatorDots" indicator-active-color="#e93323" :autoplay="autoplay" :current='current'
<swiper :indicator-dots="indicatorDots" :current='current' indicator-active-color="#e93323" :autoplay="autoplay"
:circular="circular" :interval="interval" :duration="duration" @change="change" v-if="isPlay">
<!-- #ifndef APP-PLUS -->
<swiper-item v-if="videoline && videoline != '' && videoline != 'https:'" v-for="(item,index) in videoline">
<view class="item">
<video id="myVideo" :src='item' objectFit="cover" style="width:100%;height:100% "
show-mute-btn="true" auto-pause-if-navigate @ended="endedFun()"></video>
<view class="poster" v-if="controls">
<image class="image" :src="videoCoverImg"></image>
</view>
<view class="stop" v-if="controls" @tap="bindPause" style="width: 100rpx;height: 100rpx;">
<!-- <image class="image" src="../../static/images/stop.png"></image> -->
</view>
</view>
</swiper-item>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<swiper-item v-if="videoline">
<!-- <view class="item">
<view class="poster" v-show="controls">
<image class="image" :src="videoCoverImg"></image>
</view>
<view class="stop" v-show="controls" @tap="bindPause">
<image class="image" src="../../static/images/stop.png"></image>
</view>
</view> -->
</swiper-item>
<!-- #endif -->
<block v-for="(item,index) in imgUrls" :key='index'>
<swiper-item>
<swiper-item v-if="isVideoUrl(item)">
<video :src="isVideoUrl(item,true)" objectFit="cover" controls style="width:100%;height:100% "
show-center-play-btn show-mute-btn="true" auto-pause-if-navigate
:enable-progress-gesture="false" :poster="videoCoverImg"></video>
</swiper-item>
<swiper-item v-else>
<image :src="item" class="slide-image" @click='getpreviewImage(item)' />
</swiper-item>
</block>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<block v-for="(item,index) in imgUrls" :key='index'>
<swiper-item v-if="isVideoUrl(item)">
<view>
<image :src="videoCoverImg" class="slide-image" />
<image class="image-play-icon" src="../../static/images/stop.png"
@click='videoPlay(item,index)'>
</image>
</view>
</swiper-item>
<swiper-item v-else>
<image :src="item" class="slide-image" @click='getpreviewImage(item)' />
</swiper-item>
</block>
<!-- #endif -->
</swiper>
<!-- #ifdef APP-PLUS -->
<view v-if="!isPlay" style="width: 100%; height: 750rpx;">
<!-- <!-- <video id="myVideo" :src='videoline[current]' objectFit="cover" controls style="width:100%;height:100% "
<video id="myVideo" :src='playingUrl' objectFit="cover" controls style="width:100%;height:100% "
show-center-play-btn show-mute-btn="true" auto-pause-if-navigate :enable-progress-gesture="false"
:poster="videoCoverImg" @pause="videoPause" @ended="endedFun()"></video> -->
<video id="myVideo1" :src='videoline[current]' objectFit="cover" controls style="width:100%;height:100% "
show-center-play-btn show-mute-btn="true" auto-pause-if-navigate :enable-progress-gesture="false"
:poster="videoCoverImg" @pause="videoPause" @ended="endedFun()"></video> -->
:poster="videoCoverImg" @pause="videoPause" @ended="endedFun()"></video>
</view>
<!-- #endif -->
</view>
@ -66,7 +63,7 @@
}
},
videoline: {
type: Array,
type: String,
value: ""
},
videoCoverImg: {
@ -75,7 +72,9 @@
},
data() {
return {
current: "",
current: '0',
videoTypeList: ['mp4', 'avi', 'mov', 'wmv', 'mkv', 'flv', 'mpeg', '3gp', 'webm'],
playingUrl: '',
indicatorDots: true,
circular: true,
autoplay: true,
@ -99,6 +98,25 @@
// #endif
},
methods: {
isVideoUrl(url, getRightUrl) {
const str = url;
const lastIndex = str.lastIndexOf(".");
let extension;
if (lastIndex !== -1) {
extension = str.substring(lastIndex + 1);
} else {
extension = 'jpg'
}
if (getRightUrl) return url.replace(/\\/g, "")
return this.videoTypeList.includes(extension)
},
videoPlay(url, index) {
this.playingUrl = url
this.current = index
console.log(this.current)
this.bindPause()
},
getpreviewImage: function(item) {
uni.previewImage({
urls: this.imgUrls,
@ -111,6 +129,7 @@
this.autoplay = true
// #endif
},
bindPause: function() {
// #ifndef APP-PLUS
this.videoContext.play();
@ -150,8 +169,8 @@
}
.product-bg .slide-image {
width: 100%;
height: 100%;
width: 750rpx;
height: 750rpx;
}
.product-bg .pages {
@ -207,4 +226,13 @@
width: 100%;
height: 100%;
}
.image-play-icon {
position: absolute;
width: 100rpx;
height: 100rpx;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>

View File

@ -0,0 +1,466 @@
<template>
<view :style="viewColor">
<view class="product-window"
:class="(attr.cartAttr === true ? 'on' : '') + ' ' + (iSbnt || destri?'join':'') + ' ' + (isPresell ?'presell-window':'product-window')">
<view class="textpic acea-row row-between-wrapper">
<view class="pictrue">
<image :src="attr.productSelect.image ? attr.productSelect.image : image" @click="loookImg"></image>
</view>
<view class="text">
<view class="line1">
{{ attr.productSelect.store_name }}
</view>
<view v-if="isPresell" class="money presell_price">
<view>
预售价
<text class="num">{{ attr.productSelect.price }}</text>
<text v-if="presell_type === 2">定金<text
class="num">{{ attr.productSelect.down_price }}</text></text>
</view>
<text class="stock" v-if='isShow'>库存: {{ attr.productSelect.stock }}</text>
<text class='stock' v-if="limitNum">限量: {{attr.productSelect.quota_show}}</text>
</view>
<view v-else class="money">
<view class="acea-row row-middle">
<view class="acea-row row-middle">
<text></text><text class="num">{{ attr.productSelect.price }}</text>
<view v-if="svipPrice" class="acea-row row-middle">
<text class='vip-money'>{{attr.productSelect.svip_price}}</text>
<view class="vipImg">
<image src="/static/images/svip.png"></image>
</view>
</view>
</view>
</view>
<view class="stock_count">
<text class="stock" v-if='isShow'>库12存: {{ attr.productSelect.stock }}</text>
<text class='stock' v-if="limitNum">限量: {{attr.productSelect.quota_show}}</text>
</view>
</view>
</view>
<view class="iconfont icon-guanbi" @click="closeAttr"></view>
</view>
<view class="productWinList">
<view class="item" v-for="(item, indexw) in attr.productAttr" :key="indexw">
<view class="title">{{ item.attr_name }}</view>
<view class="listn acea-row row-middle">
<view class="itemn" :class="item.index === itemn.attr ? 'on' : ''"
v-for="(itemn, indexn) in item.attr_value" @click="tapAttr(indexw, indexn)" :key="indexn">
{{ itemn.attr }}
</view>
</view>
</view>
</view>
<view class="cart acea-row">
<view class="title">数量</view>
<view class="carnum acea-row row-left">
<view class="buy_limit" v-if="minCount>0 || maxCount>0">
(<text v-if="minCount>0">{{minCount}}件起购<text
v-if="minCount>0 && maxCount>0"></text></text><text
v-if="maxCount>0">最多{{maxCount}}</text>)
</view>
<view class="item reduce" :class="attr.productSelect.cart_num <= 1 ? 'on' : ''" @click="CartNumDes">
-
</view>
<view class='item num'>
<input type="number" v-model="attr.productSelect.cart_num" data-name="productSelect.cart_num"
@input="bindCode(attr.productSelect.cart_num)" @keydown="btKeyDown"
@keyup="btKeyUp"></input>
</view>
<view v-if="iSplus" class="item plus"
:class=" attr.productSelect.cart_num >= attr.productSelect.stock || destri ? 'on' : ''"
@click="CartNumAdd">+</view>
<view v-else class='item plus' :class='(attr.productSelect.cart_num >= attr.productSelect.quota_show)
|| (attr.productSelect.cart_num >= attr.productSelect.product_stock)? "on":""' @click='CartNumAdd'>+
</view>
</view>
</view>
<view class="joinBnt b-color" v-if="destri && attr.productSelect.stock>0" @click="goCat">立即购买</view>
<view class="joinBnt on" v-else-if="destri && attr.productSelect.stock<=0">已售罄</view>
<view class="joinBnt b-color" v-if="iSbnt && attr.productSelect.stock>0" @click="goCat">我要参团</view>
<view class="joinBnt on" v-else-if="(iSbnt && attr.productSelect.stock<=0)">已售罄</view>
</view>
<view class="mask" @touchmove.prevent :hidden="attr.cartAttr === false" @click="closeAttr"></view>
</view>
</template>
<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEBCRMEB
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
mapGetters
} from "vuex";
export default {
props: {
attr: {
type: Object,
default: () => {}
},
limitNum: {
type: Number,
value: 0
},
isShow: {
type: Number,
value: 0
},
iSbnt: {
type: Number,
value: 0
},
iSplus: {
type: Number,
value: 0
},
destri: {
type: Number,
value: 0
},
isPresell: {
type: Number,
value: 0
},
presell_type: {
type: Number,
value: 1
},
image: {
type: String,
value: ''
},
maxCount: {
type: Number,
value: 0
},
minCount: {
type: Number,
value: 0
},
svipPrice: {
type: Boolean,
value: false
}
},
computed: mapGetters(['viewColor']),
data() {
return {};
},
mounted() {
console.log(this.attr, 'attr')
},
methods: {
//
loookImg() {
let self = this
let arr = [self.attr.productSelect.image ? self.attr.productSelect.image : self.image]
uni.previewImage({
urls: arr,
});
},
goCat: function() {
this.$emit('goCat');
},
/**
* 购物车手动输入数量
*
*/
bindCode: function(e) {
let num = JSON.parse(JSON.stringify(e))
this.$emit('iptCartNum', num);
},
btKeyDown(e) {
e.target.value = e.target.value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g, "");
},
btKeyUp(e) {
e.target.value = e.target.value.replace(
/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, "")
},
closeAttr: function() {
this.$emit('myevent');
},
CartNumDes: function() {
if (!this.destri) {
this.$emit('ChangeCartNum', false);
}
},
CartNumAdd: function() {
if (!this.destri) {
this.$emit('ChangeCartNum', true);
}
},
tapAttr: function(indexw, indexn) {
let that = this;
that.$emit("attrVal", {
indexw: indexw,
indexn: indexn
});
this.$set(this.attr.productAttr[indexw], 'index', this.attr.productAttr[indexw].attr_values[indexn]);
let value = that.getCheckedValue().join(",");
that.$emit("ChangeAttr", value);
},
//
getCheckedValue: function() {
let productAttr = this.attr.productAttr;
let value = [];
for (let i = 0; i < productAttr.length; i++) {
for (let j = 0; j < productAttr[i].attr_values.length; j++) {
if (productAttr[i].index === productAttr[i].attr_values[j]) {
value.push(productAttr[i].attr_values[j]);
}
}
}
return value;
}
}
}
</script>
<style scoped lang="scss">
.product-window {
position: fixed;
bottom: 0;
width: 100%;
left: 0;
background-color: #fff;
z-index: 77;
border-radius: 16rpx 16rpx 0 0;
padding-bottom: 140rpx;
padding-bottom: calc(140rpx+ constant(safe-area-inset-bottom)); /// IOS<11.2/
padding-bottom: calc(140rpx + env(safe-area-inset-bottom)); /// IOS>11.2/
transform: translate3d(0, 100%, 0);
transition: all .3s cubic-bezier(.25, .5, .5, .9);
&.presell-window {
padding-bottom: 200rpx;
}
}
.product-window.on {
transform: translate3d(0, 0, 0);
}
.product-window.join {
padding-bottom: 30rpx;
}
.product-window .textpic {
padding: 0 80rpx 0 30rpx;
margin-top: 29rpx;
position: relative;
}
.product-window .textpic .pictrue {
width: 150rpx;
height: 150rpx;
}
.product-window .textpic .pictrue image {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
.product-window .textpic .text {
width: 460rpx;
font-size: 32rpx;
color: #202020;
}
.product-window .textpic .text .money {
font-size: 24rpx;
margin-top: 26rpx;
font-weight: 700;
color: var(--view-priceColor);
}
.product-window .stock_count {
margin-top: 5rpx;
}
.product-window .textpic .text .money .num {
font-size: 36rpx;
}
.product-window .textpic .text .money .stock {
color: #999;
margin-left: 18rpx;
font-weight: normal;
}
.product-window .textpic .text .presell_price {
color: #FF7F00;
.num {
display: inline-block;
margin-right: 20rpx;
}
.stock {
margin-left: 0;
}
}
.vip-money {
color: #282828;
font-size: 22rpx;
margin-left: 6rpx;
}
.vipImg {
width: 65rpx;
height: 28rpx;
margin-left: 4rpx;
image {
width: 100%;
height: 100%;
display: block;
}
}
.product-window .textpic .iconfont {
position: absolute;
right: 30rpx;
top: -5rpx;
font-size: 35rpx;
color: #8a8a8a;
}
.product-window .productWinList {
max-height: 395rpx;
overflow: auto;
margin-top: 36rpx;
}
.product-window .productWinList .item~.item {
margin-top: 36rpx;
}
.product-window .productWinList .item .title {
font-size: 30rpx;
color: #999;
padding: 0 30rpx;
}
.product-window .productWinList .item .listn {
padding: 0 30rpx 0 16rpx;
}
.product-window .productWinList .item .listn .itemn {
border: 1px solid #bbb;
font-size: 26rpx;
color: #282828;
padding: 7rpx 33rpx;
border-radius: 6rpx;
margin: 14rpx 0 0 14rpx;
}
.product-window .productWinList .item .listn .itemn.on {
color: #fff;
background-color: var(--view-theme);
border-color: var(--view-theme);
}
.product-window .cart {
margin-top: 36rpx;
padding: 0 30rpx;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}
.product-window .cart .title {
font-size: 30rpx;
color: #999;
line-height: 54rpx;
}
.product-window .cart .carnum {
height: 54rpx;
align-items: center;
}
.product-window .cart .carnum .buy_limit {
font-size: 22rpx;
color: var(--view-theme);
margin-right: 30rpx;
}
.product-window .cart .carnum .item {
width: 63rpx;
text-align: center;
height: 100%;
line-height: 42rpx;
color: #333333;
font-weight: 400;
font-size: 26rpx;
}
.product-window .cart .carnum .reduce {
border: 1px solid #a4a4a4;
width: 44rpx;
height: 42rpx;
// border-right: 0;
border-radius: 0 7rpx 7rpx 0;
line-height: 30rpx;
}
.product-window .cart .carnum .reduce.on {
border-color: #e3e3e3;
color: #dedede;
}
.product-window .cart .carnum .plus {
border: 1px solid #a4a4a4;
width: 44rpx;
height: 42rpx;
// border-right: 0;
border-radius: 0 7rpx 7rpx 0;
line-height: 30rpx
}
.product-window .cart .carnum .plus.on {
border-color: #e3e3e3;
color: #dedede;
}
.product-window .cart .carnum .num {
color: #282828;
font-size: 28rpx;
}
.product-window .joinBnt {
font-size: 30rpx;
width: 620rpx;
height: 86rpx;
border-radius: 50rpx;
text-align: center;
line-height: 86rpx;
color: #fff;
margin: 21rpx auto 0 auto;
&.b-color {
background-color: var(--view-theme);
}
}
.product-window .joinBnt.on {
background-color: #bbb;
color: #fff;
}
</style>

View File

@ -4,7 +4,9 @@
<scroll-view :scroll-top="scrollTop" scroll-y='true' scroll-with-animation="true"
:style='"height:"+height+"px;"' @scroll="scroll">
<view id="past0">
<productConSwiper :imgUrls="imgUrls" :videoCoverImg="videoCoverImg" :videoline="videoline">
<productConSwiper :imgUrls="storeInfo.slider_image"
videoCoverImg="https://tse3-mm.cn.bing.net/th/id/OIP-C.8fSZO4qDjGmIuSfxRNAFpgHaE8?w=270&h=180&c=7&r=0&o=5&dpr=1.3&pid=1.7"
videoline="https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/51838202404242300059216.mp4">
</productConSwiper>
<!--秒杀-->
<view v-if="storeInfo.product_type == 1" class='nav acea-row row-between-wrapper'>
@ -295,9 +297,22 @@
{{description.content.title}}
</view>
<block v-if="description.content && description.content.image">
<image v-for="(item,index) in description.content.image" :key="index" :src="item"
mode="widthFix" style="background-color: #fff;width: 100vw;">
<view class="" v-for="(item,index) in description.content.image" :key="index">
<view class="" v-if='videoTypeList.includes(getSuffix(item))'>
<view class="" style="background-color: red;width: 100rpx;height: 100rpx;"
@click="bindPause">
{{item}}
</view>
<!-- <video id="myVideo"
:src='item && (item.substring(0,4) == "http" || item.substring(0,5) == "https") ? item : "http:" + item'
objectFit="cover" controls style="width:100%;height:100% " show-center-play-btn
show-mute-btn="true" auto-pause-if-navigate :enable-progress-gesture="false"
:poster="videoCoverImg" @pause="videoPause" @ended="endedFun()"></video> -->
</view>
<image :src="item" mode="widthFix" style="background-color: #fff;width: 100vw;">
</image>
</view>
</block>
</view>
</view>
@ -355,8 +370,10 @@
data() {
let that = this;
return {
videoline: [],
vidioTypeList: ['mp4', 'avi', 'mov', 'wmv', 'mkv', 'flv', 'mpeg', '3gp', 'webm'],
show: false,
autoplay: false,
isPlay: false,
videoTypeList: ['mp4', 'avi', 'mov', 'wmv', 'mkv', 'flv', 'mpeg', '3gp', 'webm'],
statusBarHeight: statusBarHeight, //
attrTxt: '请选择', //
attrValue: '', //
@ -463,7 +480,19 @@
// this.getConfig()
},
methods: {
//
bindPause: function() {
this.show = true
console.log(this.isPlay, 'isplsfds')
this.isPlay = false
this.videoContext = uni.createVideoContext('myVideo', this);
this.$nextTick(() => {
this.videoContext.play();
})
},
endedFun() {
this.controls = true
},
getSuffix(url) {
const str = url;
const lastIndex = str.lastIndexOf(".");
@ -609,11 +638,12 @@
this.videoCoverImg = storeInfo.slider_image[0]
storeInfo.slider_image.splice(0, 1)
} else if (storeInfo.video_link && storeInfo.slider_image.length === 1) {
this.videoCoverImg = storeInfo.slider_image[0]
}
that.$set(that, 'storeInfo', storeInfo);
that.$set(that, 'description', storeInfo.content);
// that.description
console.log(that.description, 'sd')
if (typeof that.description.content == 'string') {
try {
that.description.content = JSON.parse(that.description.content);
@ -677,21 +707,8 @@
product_type: that.product_type
}
getPreviewProDetail(params).then(res => {
this.videoline = []
this.imgUrls = []
res.data.slider_image.forEach(item => {
if (this.vidioTypeList.includes(this.getSuffix(item))) {
this.videoline.push(item.replace(/\\/g, ""))
} else {
this.imgUrls.push(item.replace(/\\/g, ""))
}
})
// storeInfo.slider_image.filter(item=> !vidioTypeList.includes(getSuffix(item)))
uni.hideLoading();
let storeInfo = res.data;
// console.log(storeInfo, 'sdsdsd')
if (storeInfo.video_link && storeInfo.slider_image.length > 1) {
this.videoCoverImg = storeInfo.slider_image[0]
storeInfo.slider_image.splice(0, 1)
@ -700,6 +717,10 @@
}
that.$set(that, 'storeInfo', storeInfo);
that.$set(that, 'description', storeInfo.content);
that.description?.content.image.forEach(item => {
item = item.replace(/\\/g, "")
})
if (typeof that.description.content == 'string') {
try {
that.description.content = JSON.parse(that.description.content);

View File

@ -171,11 +171,11 @@
</view>
</view>
</u-popup>
<u-popup :show="searchGoodsShow" @close="searchGoodsClose" :round="18" mode="center">
<u-popup :show="searchGoodsShow" :round="18" mode="center">
<view class="search_goods_box">
<input type="text" v-model="searchGoodsName" class="searchGoods" placeholder="请输入商品名称">
<view class="search_goods_btn">
<view class="cancel edit_btn" @click="searchGoodsShow=false">取消</view>
<view class="cancel edit_btn" @click="handCancel">取消</view>
<view class="search edit_btn" @click="searchGoodsClose">搜索</view>
</view>
</view>
@ -194,6 +194,7 @@
import {
productCreate
} from '@/api/product.js'
import {
microSeachBarCode,
microEadtProduct,
@ -293,7 +294,13 @@
this.userInfo = this.$store.state.app.userInfo;
if (typeof this.userInfo == 'string') this.userInfo = JSON.parse(this.userInfo);
if (e.type) {
uni.showLoading({
title: '正在加载中'
});
setTimeout(() => {
uni.hideLoading();
this.navigato(e.type)
}, 700)
}
// if(this.userInfo.mer_info.type_code=='PersonalStore'){
// this.goodsData = [{
@ -308,8 +315,18 @@
},
methods: {
handCancel() {
uni.redirectTo({
url: '/pages/product/list/index'
})
},
addGoods(item = {}) {
item = JSON.parse(JSON.stringify(item));
item = (JSON.stringify(item));
console.log(item)
uni.navigateTo({
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${this.mer_id}&&goodsInfo=${item}`
})
return
// if(this.isNullImage(item.image)||
// ( this.isNullImage(item.slider_image[0]) && this.isNullImage(item.slider_image[1]) && this.isNullImage(item.slider_image[2]) )){
// return Toast('');
@ -630,7 +647,7 @@
this.pageType = 1;
} else if (type == 2) {
this.scanCode();
this.pageType = 1;
// this.pageType = 1;
} else {
// this.photograph();
// this.pageType = 2;
@ -655,6 +672,7 @@
return regex.test(str);
},
async seachBarCode(code) {
console.log("laizheer;e1")
if (code.length < 12) {
return Toast('条形码长度不正确, 请重试!')
}
@ -763,6 +781,15 @@
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
onBackPress: function(e) {
uni.redirectTo({
url: '/pages/product/list/index'
})
// uni.navigateBack()
// return false
// this.showlay = true
// return this.go;
}
}
</script>

View File

@ -207,7 +207,7 @@
}, ],
"attrValue": [{
detail: {
规格名: '',
},
"price": "",
"unit_name": "",
@ -472,6 +472,7 @@
.split('--')[1] : JSON.parse(option.data).label;
this.formData.cate_id = JSON.parse(option.data).value
}
console.log(this.formData.attrValue[0].detail)
},
};
</script>

View File

@ -166,11 +166,9 @@
</u-form-item>
</view>
<view class="" v-else>
<u-form-item :label="formData.attr[index].value" label-width="350rpx" prop="userInfo.name"
ref="item1" labelPosition="left" border-bottom>
<u-form-item :label="item.sku" label-width="350rpx" prop="userInfo.name" ref="item1"
labelPosition="left" border-bottom>
<view class="" style="display: flex;justify-content: space-between;width: 100%">
<view style="width: 250rpx;" v-if='!formData.attr[index].value'>
</view>
<view style="font-size: 28rpx;color:#777777 ;">
零售价
</view>
@ -319,12 +317,14 @@
],
attr: [{
detail: [],
detail: [{
attr: 'name'
}],
value: " "
}, ],
"attrValue": [{
detail: {
规格名: '',
},
"price": "",
"unit_name": "",
@ -524,7 +524,7 @@
const extension = str.substring(lastIndex + 1);
return extension
} else {
console.log("字符串中没有找到点号。");
return 'asdasdsadsd'
}
},
choseMedia(e) {
@ -721,6 +721,12 @@
if (option.formData) {
this.formData = JSON.parse(option.formData)
}
if (option.goodsInfo) {
let goods = JSON.parse(option.goodsInfo)
console.log(goods)
this.formData.store_name = goods.store_name
this.formData.imageList = [goods.image, ...[goods.slider_image]]
}
}
},
@ -736,7 +742,6 @@
this.mode = 'edit'
this.showSet = true
productDetail(option.mer_id, option.product_id).then(res => {
console.log(res.data)
Object.assign(this.formData, res.data)
this.$set(this.formData, "imageList", res.data.image_list)
this.formData.product_attribute = JSON.parse(this.formData.product_attribute)
@ -744,7 +749,6 @@
this.formData.cate_id = this.formData.storeCategory.store_category_id
delete this.formData.image_list
if (!this.formData.imageList) this.formData.imageList = []
console.log(this.formData)
})
}
},

View File

@ -7,7 +7,9 @@
<view class="card-head card-li">
<text style="font-size: 32rpx;font-family: PingFangFamily;">规格{{index+1}}</text>
<view class="" style="width: 300rpx;">
<u--input placeholder="请输入规格名称" inputAlign='right' v-model="formData.attr[index].value"></u--input>
<!-- {{formData.attr}} -->
<!-- <u--input placeholder="请输入规格名称" inputAlign='right' v-model="formData.attr[index].value"></u--input> -->
<u--input placeholder="请输入规格名称" inputAlign='right' v-model="item.sku"></u--input>
</view>
</view>
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
@ -137,7 +139,7 @@
formData: {},
"attrValue": [{
detail: {
规格名: 'attr[index]value',
' ': '',
},
"price": "",
"unit_name": "",
@ -145,7 +147,7 @@
"wholesale_price": '',
"cost": "",
"stock": "",
sku: 'attr[index]value',
sku: '',
"ot_price": "",
"procure_price": "",
"bar_code": "",
@ -197,7 +199,7 @@
pushFn() {
this.attrValue.push({
detail: {
规格名: 'attr[index]value',
' ': '',
},
"price": "",
"unit_name": "",
@ -205,7 +207,7 @@
"wholesale_price": '',
"cost": "",
"stock": "",
sku: 'attr[index]value',
sku: '',
"ot_price": "",
"procure_price": "",
"bar_code": "",
@ -217,13 +219,14 @@
"is_use": true,
})
this.formData.attr.push({
value: '',
detail: [],
})
// this.formData.attr.push({
// value: '',
// detail: [],
// })
},
submit() {
//
let errList = []
if (!this.isWholeSale) {
delete this.rules.wholesale_unit_name
@ -252,18 +255,25 @@
uni.$u.toast('请填写规格名称')
return
}
//
this.formData.attr[0].detail = []
this.attrValue.forEach(item => {
item.detail[' '] = item.sku
console.log(this.formData.attr)
this.formData.attr[0].detail.push(item.sku)
})
this.formData.attrValue = this.attrValue
this.formData.attrValue.forEach(item => {
item.is_use = item.is_use ? '0' : '1'
})
let that = this
this.formData.attrValue.forEach((item, index) => {
item.detail.规格名 = this.formData.attr[index].value
item.sku = this.formData.attr[index].value
// this.formData.attrValue.forEach((item, index) => {
// item.detail. = this.formData.attr[index].value
// item.sku = this.formData.attr[index].value
})
// })
this.formData.spec_type = this.formData.attrValue.length > 1 ? '1' : '0'
uni.reLaunch({
uni.redirectTo({
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${that.mer_id}&&formData=${JSON.stringify(that.formData) }&&showSet=${true}`
})
},
@ -289,6 +299,7 @@
detail: [],
})
}
console.log(this.formData)
}
}