商品详情修改
This commit is contained in:
parent
6dff85d544
commit
1a01e1ae65
|
@ -1,47 +1,44 @@
|
||||||
<template>
|
<template>
|
||||||
<view class='product-bg'>
|
<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">
|
:circular="circular" :interval="interval" :duration="duration" @change="change" v-if="isPlay">
|
||||||
<!-- #ifndef APP-PLUS -->
|
<!-- #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'>
|
<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)' />
|
<image :src="item" class="slide-image" @click='getpreviewImage(item)' />
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</block>
|
</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>
|
</swiper>
|
||||||
|
|
||||||
<!-- #ifdef APP-PLUS -->
|
<!-- #ifdef APP-PLUS -->
|
||||||
<view v-if="!isPlay" style="width: 100%; height: 750rpx;">
|
<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"
|
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>
|
||||||
<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> -->
|
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
|
@ -66,7 +63,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
videoline: {
|
videoline: {
|
||||||
type: Array,
|
type: String,
|
||||||
value: ""
|
value: ""
|
||||||
},
|
},
|
||||||
videoCoverImg: {
|
videoCoverImg: {
|
||||||
|
@ -75,7 +72,9 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
current: "",
|
current: '0',
|
||||||
|
videoTypeList: ['mp4', 'avi', 'mov', 'wmv', 'mkv', 'flv', 'mpeg', '3gp', 'webm'],
|
||||||
|
playingUrl: '',
|
||||||
indicatorDots: true,
|
indicatorDots: true,
|
||||||
circular: true,
|
circular: true,
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
|
@ -99,6 +98,25 @@
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
getpreviewImage: function(item) {
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls: this.imgUrls,
|
urls: this.imgUrls,
|
||||||
|
@ -111,6 +129,7 @@
|
||||||
this.autoplay = true
|
this.autoplay = true
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
|
||||||
bindPause: function() {
|
bindPause: function() {
|
||||||
// #ifndef APP-PLUS
|
// #ifndef APP-PLUS
|
||||||
this.videoContext.play();
|
this.videoContext.play();
|
||||||
|
@ -150,8 +169,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-bg .slide-image {
|
.product-bg .slide-image {
|
||||||
width: 100%;
|
width: 750rpx;
|
||||||
height: 100%;
|
height: 750rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-bg .pages {
|
.product-bg .pages {
|
||||||
|
@ -207,4 +226,13 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.image-play-icon {
|
||||||
|
position: absolute;
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -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 CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 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>
|
|
@ -4,7 +4,9 @@
|
||||||
<scroll-view :scroll-top="scrollTop" scroll-y='true' scroll-with-animation="true"
|
<scroll-view :scroll-top="scrollTop" scroll-y='true' scroll-with-animation="true"
|
||||||
:style='"height:"+height+"px;"' @scroll="scroll">
|
:style='"height:"+height+"px;"' @scroll="scroll">
|
||||||
<view id="past0">
|
<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>
|
</productConSwiper>
|
||||||
<!--秒杀-->
|
<!--秒杀-->
|
||||||
<view v-if="storeInfo.product_type == 1" class='nav acea-row row-between-wrapper'>
|
<view v-if="storeInfo.product_type == 1" class='nav acea-row row-between-wrapper'>
|
||||||
|
@ -295,9 +297,22 @@
|
||||||
{{description.content.title}}
|
{{description.content.title}}
|
||||||
</view>
|
</view>
|
||||||
<block v-if="description.content && description.content.image">
|
<block v-if="description.content && description.content.image">
|
||||||
<image v-for="(item,index) in description.content.image" :key="index" :src="item"
|
<view class="" v-for="(item,index) in description.content.image" :key="index">
|
||||||
mode="widthFix" style="background-color: #fff;width: 100vw;">
|
<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>
|
</image>
|
||||||
|
</view>
|
||||||
|
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -355,8 +370,10 @@
|
||||||
data() {
|
data() {
|
||||||
let that = this;
|
let that = this;
|
||||||
return {
|
return {
|
||||||
videoline: [],
|
show: false,
|
||||||
vidioTypeList: ['mp4', 'avi', 'mov', 'wmv', 'mkv', 'flv', 'mpeg', '3gp', 'webm'],
|
autoplay: false,
|
||||||
|
isPlay: false,
|
||||||
|
videoTypeList: ['mp4', 'avi', 'mov', 'wmv', 'mkv', 'flv', 'mpeg', '3gp', 'webm'],
|
||||||
statusBarHeight: statusBarHeight, //系统导航条高度
|
statusBarHeight: statusBarHeight, //系统导航条高度
|
||||||
attrTxt: '请选择', //属性页面提示
|
attrTxt: '请选择', //属性页面提示
|
||||||
attrValue: '', //已选属性
|
attrValue: '', //已选属性
|
||||||
|
@ -463,7 +480,19 @@
|
||||||
// this.getConfig()
|
// this.getConfig()
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
getSuffix(url) {
|
||||||
const str = url;
|
const str = url;
|
||||||
const lastIndex = str.lastIndexOf(".");
|
const lastIndex = str.lastIndexOf(".");
|
||||||
|
@ -609,11 +638,12 @@
|
||||||
this.videoCoverImg = storeInfo.slider_image[0]
|
this.videoCoverImg = storeInfo.slider_image[0]
|
||||||
storeInfo.slider_image.splice(0, 1)
|
storeInfo.slider_image.splice(0, 1)
|
||||||
} else if (storeInfo.video_link && storeInfo.slider_image.length === 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, 'storeInfo', storeInfo);
|
||||||
that.$set(that, 'description', storeInfo.content);
|
that.$set(that, 'description', storeInfo.content);
|
||||||
|
// that.description
|
||||||
|
console.log(that.description, 'sd')
|
||||||
if (typeof that.description.content == 'string') {
|
if (typeof that.description.content == 'string') {
|
||||||
try {
|
try {
|
||||||
that.description.content = JSON.parse(that.description.content);
|
that.description.content = JSON.parse(that.description.content);
|
||||||
|
@ -677,21 +707,8 @@
|
||||||
product_type: that.product_type
|
product_type: that.product_type
|
||||||
}
|
}
|
||||||
getPreviewProDetail(params).then(res => {
|
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();
|
uni.hideLoading();
|
||||||
let storeInfo = res.data;
|
let storeInfo = res.data;
|
||||||
// console.log(storeInfo, 'sdsdsd')
|
|
||||||
if (storeInfo.video_link && storeInfo.slider_image.length > 1) {
|
if (storeInfo.video_link && storeInfo.slider_image.length > 1) {
|
||||||
this.videoCoverImg = storeInfo.slider_image[0]
|
this.videoCoverImg = storeInfo.slider_image[0]
|
||||||
storeInfo.slider_image.splice(0, 1)
|
storeInfo.slider_image.splice(0, 1)
|
||||||
|
@ -700,6 +717,10 @@
|
||||||
}
|
}
|
||||||
that.$set(that, 'storeInfo', storeInfo);
|
that.$set(that, 'storeInfo', storeInfo);
|
||||||
that.$set(that, 'description', storeInfo.content);
|
that.$set(that, 'description', storeInfo.content);
|
||||||
|
|
||||||
|
that.description?.content.image.forEach(item => {
|
||||||
|
item = item.replace(/\\/g, "")
|
||||||
|
})
|
||||||
if (typeof that.description.content == 'string') {
|
if (typeof that.description.content == 'string') {
|
||||||
try {
|
try {
|
||||||
that.description.content = JSON.parse(that.description.content);
|
that.description.content = JSON.parse(that.description.content);
|
||||||
|
|
|
@ -171,11 +171,11 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</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">
|
<view class="search_goods_box">
|
||||||
<input type="text" v-model="searchGoodsName" class="searchGoods" placeholder="请输入商品名称">
|
<input type="text" v-model="searchGoodsName" class="searchGoods" placeholder="请输入商品名称">
|
||||||
<view class="search_goods_btn">
|
<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 class="search edit_btn" @click="searchGoodsClose">搜索</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -194,6 +194,7 @@
|
||||||
import {
|
import {
|
||||||
productCreate
|
productCreate
|
||||||
} from '@/api/product.js'
|
} from '@/api/product.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
microSeachBarCode,
|
microSeachBarCode,
|
||||||
microEadtProduct,
|
microEadtProduct,
|
||||||
|
@ -293,7 +294,13 @@
|
||||||
this.userInfo = this.$store.state.app.userInfo;
|
this.userInfo = this.$store.state.app.userInfo;
|
||||||
if (typeof this.userInfo == 'string') this.userInfo = JSON.parse(this.userInfo);
|
if (typeof this.userInfo == 'string') this.userInfo = JSON.parse(this.userInfo);
|
||||||
if (e.type) {
|
if (e.type) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在加载中'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading();
|
||||||
this.navigato(e.type)
|
this.navigato(e.type)
|
||||||
|
}, 700)
|
||||||
}
|
}
|
||||||
// if(this.userInfo.mer_info.type_code=='PersonalStore'){
|
// if(this.userInfo.mer_info.type_code=='PersonalStore'){
|
||||||
// this.goodsData = [{
|
// this.goodsData = [{
|
||||||
|
@ -308,8 +315,18 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handCancel() {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/product/list/index'
|
||||||
|
})
|
||||||
|
},
|
||||||
addGoods(item = {}) {
|
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)||
|
// if(this.isNullImage(item.image)||
|
||||||
// ( this.isNullImage(item.slider_image[0]) && this.isNullImage(item.slider_image[1]) && this.isNullImage(item.slider_image[2]) )){
|
// ( this.isNullImage(item.slider_image[0]) && this.isNullImage(item.slider_image[1]) && this.isNullImage(item.slider_image[2]) )){
|
||||||
// return Toast('请先上传商品图片后再加入店铺');
|
// return Toast('请先上传商品图片后再加入店铺');
|
||||||
|
@ -630,7 +647,7 @@
|
||||||
this.pageType = 1;
|
this.pageType = 1;
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
this.scanCode();
|
this.scanCode();
|
||||||
this.pageType = 1;
|
// this.pageType = 1;
|
||||||
} else {
|
} else {
|
||||||
// this.photograph();
|
// this.photograph();
|
||||||
// this.pageType = 2;
|
// this.pageType = 2;
|
||||||
|
@ -655,6 +672,7 @@
|
||||||
return regex.test(str);
|
return regex.test(str);
|
||||||
},
|
},
|
||||||
async seachBarCode(code) {
|
async seachBarCode(code) {
|
||||||
|
console.log("laizheer;e1")
|
||||||
if (code.length < 12) {
|
if (code.length < 12) {
|
||||||
return Toast('条形码长度不正确, 请重试!')
|
return Toast('条形码长度不正确, 请重试!')
|
||||||
}
|
}
|
||||||
|
@ -763,6 +781,15 @@
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
},
|
},
|
||||||
|
onBackPress: function(e) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/product/list/index'
|
||||||
|
})
|
||||||
|
// uni.navigateBack()
|
||||||
|
// return false
|
||||||
|
// this.showlay = true
|
||||||
|
// return this.go;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
}, ],
|
}, ],
|
||||||
"attrValue": [{
|
"attrValue": [{
|
||||||
detail: {
|
detail: {
|
||||||
规格名: '',
|
|
||||||
},
|
},
|
||||||
"price": "",
|
"price": "",
|
||||||
"unit_name": "",
|
"unit_name": "",
|
||||||
|
@ -472,6 +472,7 @@
|
||||||
.split('--')[1] : JSON.parse(option.data).label;
|
.split('--')[1] : JSON.parse(option.data).label;
|
||||||
this.formData.cate_id = JSON.parse(option.data).value
|
this.formData.cate_id = JSON.parse(option.data).value
|
||||||
}
|
}
|
||||||
|
console.log(this.formData.attrValue[0].detail)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -166,11 +166,9 @@
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</view>
|
</view>
|
||||||
<view class="" v-else>
|
<view class="" v-else>
|
||||||
<u-form-item :label="formData.attr[index].value" label-width="350rpx" prop="userInfo.name"
|
<u-form-item :label="item.sku" label-width="350rpx" prop="userInfo.name" ref="item1"
|
||||||
ref="item1" labelPosition="left" border-bottom>
|
labelPosition="left" border-bottom>
|
||||||
<view class="" style="display: flex;justify-content: space-between;width: 100%">
|
<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 style="font-size: 28rpx;color:#777777 ;">
|
||||||
零售价
|
零售价
|
||||||
</view>
|
</view>
|
||||||
|
@ -319,12 +317,14 @@
|
||||||
|
|
||||||
],
|
],
|
||||||
attr: [{
|
attr: [{
|
||||||
detail: [],
|
detail: [{
|
||||||
|
attr: 'name'
|
||||||
|
}],
|
||||||
value: " "
|
value: " "
|
||||||
}, ],
|
}, ],
|
||||||
"attrValue": [{
|
"attrValue": [{
|
||||||
detail: {
|
detail: {
|
||||||
规格名: '',
|
|
||||||
},
|
},
|
||||||
"price": "",
|
"price": "",
|
||||||
"unit_name": "",
|
"unit_name": "",
|
||||||
|
@ -524,7 +524,7 @@
|
||||||
const extension = str.substring(lastIndex + 1);
|
const extension = str.substring(lastIndex + 1);
|
||||||
return extension
|
return extension
|
||||||
} else {
|
} else {
|
||||||
console.log("字符串中没有找到点号。");
|
return 'asdasdsadsd'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
choseMedia(e) {
|
choseMedia(e) {
|
||||||
|
@ -721,6 +721,12 @@
|
||||||
if (option.formData) {
|
if (option.formData) {
|
||||||
this.formData = JSON.parse(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.mode = 'edit'
|
||||||
this.showSet = true
|
this.showSet = true
|
||||||
productDetail(option.mer_id, option.product_id).then(res => {
|
productDetail(option.mer_id, option.product_id).then(res => {
|
||||||
console.log(res.data)
|
|
||||||
Object.assign(this.formData, res.data)
|
Object.assign(this.formData, res.data)
|
||||||
this.$set(this.formData, "imageList", res.data.image_list)
|
this.$set(this.formData, "imageList", res.data.image_list)
|
||||||
this.formData.product_attribute = JSON.parse(this.formData.product_attribute)
|
this.formData.product_attribute = JSON.parse(this.formData.product_attribute)
|
||||||
|
@ -744,7 +749,6 @@
|
||||||
this.formData.cate_id = this.formData.storeCategory.store_category_id
|
this.formData.cate_id = this.formData.storeCategory.store_category_id
|
||||||
delete this.formData.image_list
|
delete this.formData.image_list
|
||||||
if (!this.formData.imageList) this.formData.imageList = []
|
if (!this.formData.imageList) this.formData.imageList = []
|
||||||
console.log(this.formData)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
<view class="card-head card-li">
|
<view class="card-head card-li">
|
||||||
<text style="font-size: 32rpx;font-family: PingFangFamily;">规格{{index+1}}</text>
|
<text style="font-size: 32rpx;font-family: PingFangFamily;">规格{{index+1}}</text>
|
||||||
<view class="" style="width: 300rpx;">
|
<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>
|
||||||
</view>
|
</view>
|
||||||
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
|
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
|
||||||
|
@ -137,7 +139,7 @@
|
||||||
formData: {},
|
formData: {},
|
||||||
"attrValue": [{
|
"attrValue": [{
|
||||||
detail: {
|
detail: {
|
||||||
规格名: 'attr[index]value',
|
' ': '',
|
||||||
},
|
},
|
||||||
"price": "",
|
"price": "",
|
||||||
"unit_name": "",
|
"unit_name": "",
|
||||||
|
@ -145,7 +147,7 @@
|
||||||
"wholesale_price": '',
|
"wholesale_price": '',
|
||||||
"cost": "",
|
"cost": "",
|
||||||
"stock": "",
|
"stock": "",
|
||||||
sku: 'attr[index]value',
|
sku: '',
|
||||||
"ot_price": "",
|
"ot_price": "",
|
||||||
"procure_price": "",
|
"procure_price": "",
|
||||||
"bar_code": "",
|
"bar_code": "",
|
||||||
|
@ -197,7 +199,7 @@
|
||||||
pushFn() {
|
pushFn() {
|
||||||
this.attrValue.push({
|
this.attrValue.push({
|
||||||
detail: {
|
detail: {
|
||||||
规格名: 'attr[index]value',
|
' ': '',
|
||||||
},
|
},
|
||||||
"price": "",
|
"price": "",
|
||||||
"unit_name": "",
|
"unit_name": "",
|
||||||
|
@ -205,7 +207,7 @@
|
||||||
"wholesale_price": '',
|
"wholesale_price": '',
|
||||||
"cost": "",
|
"cost": "",
|
||||||
"stock": "",
|
"stock": "",
|
||||||
sku: 'attr[index]value',
|
sku: '',
|
||||||
"ot_price": "",
|
"ot_price": "",
|
||||||
"procure_price": "",
|
"procure_price": "",
|
||||||
"bar_code": "",
|
"bar_code": "",
|
||||||
|
@ -217,13 +219,14 @@
|
||||||
"is_use": true,
|
"is_use": true,
|
||||||
|
|
||||||
})
|
})
|
||||||
this.formData.attr.push({
|
// this.formData.attr.push({
|
||||||
value: '',
|
// value: '',
|
||||||
detail: [],
|
// detail: [],
|
||||||
})
|
// })
|
||||||
|
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
|
// 校验
|
||||||
let errList = []
|
let errList = []
|
||||||
if (!this.isWholeSale) {
|
if (!this.isWholeSale) {
|
||||||
delete this.rules.wholesale_unit_name
|
delete this.rules.wholesale_unit_name
|
||||||
|
@ -252,18 +255,25 @@
|
||||||
uni.$u.toast('请填写规格名称')
|
uni.$u.toast('请填写规格名称')
|
||||||
return
|
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 = this.attrValue
|
||||||
this.formData.attrValue.forEach(item => {
|
this.formData.attrValue.forEach(item => {
|
||||||
item.is_use = item.is_use ? '0' : '1'
|
item.is_use = item.is_use ? '0' : '1'
|
||||||
})
|
})
|
||||||
let that = this
|
let that = this
|
||||||
this.formData.attrValue.forEach((item, index) => {
|
// this.formData.attrValue.forEach((item, index) => {
|
||||||
item.detail.规格名 = this.formData.attr[index].value
|
// item.detail.规格名 = this.formData.attr[index].value
|
||||||
item.sku = this.formData.attr[index].value
|
// item.sku = this.formData.attr[index].value
|
||||||
|
|
||||||
})
|
// })
|
||||||
this.formData.spec_type = this.formData.attrValue.length > 1 ? '1' : '0'
|
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}`
|
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${that.mer_id}&&formData=${JSON.stringify(that.formData) }&&showSet=${true}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -289,6 +299,7 @@
|
||||||
detail: [],
|
detail: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
console.log(this.formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue