价格 数量修改

This commit is contained in:
1154079537 2024-05-16 17:34:29 +08:00
parent fdd60d7eb1
commit 1bc054be5d
6 changed files with 92 additions and 36 deletions

View File

@ -1,6 +1,7 @@
<template>
<view :style="viewColor">
<view class="product-window" :class="(attr.cartAttr === true ? 'on' : '') + ' ' + (iSbnt || destri?'join':'') + ' ' + (isPresell ?'presell-window':'product-window')">
<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>
@ -13,7 +14,8 @@
<view>
预售价
<text class="num">{{ attr.productSelect.price }}</text>
<text v-if="presell_type === 2">定金¥<text class="num">{{ attr.productSelect.down_price }}</text></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>
@ -42,8 +44,8 @@
<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">
<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>
@ -53,25 +55,29 @@
<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>)
(<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>
<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-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>
|| (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 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>
@ -88,7 +94,9 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import { mapGetters } from "vuex";
import {
mapGetters
} from "vuex";
export default {
props: {
attr: {
@ -144,11 +152,10 @@
data() {
return {};
},
mounted(){
},
mounted() {},
methods: {
//
loookImg(){
loookImg() {
let self = this
let arr = [self.attr.productSelect.image ? self.attr.productSelect.image : self.image]
uni.previewImage({
@ -167,10 +174,11 @@
this.$emit('iptCartNum', num);
},
btKeyDown(e) {
e.target.value = e.target.value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g,"");
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,"")
e.target.value = e.target.value.replace(
/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, "")
},
closeAttr: function() {
this.$emit('myevent');
@ -226,77 +234,95 @@
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{
.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;
@ -304,22 +330,27 @@
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;
@ -328,11 +359,13 @@
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;
@ -345,22 +378,26 @@
-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%;
@ -368,8 +405,9 @@
color: #333333;
font-weight: 400;
font-size: 26rpx;
}
.product-window .cart .carnum .reduce {
border: 1px solid #a4a4a4;
width: 44rpx;
@ -377,12 +415,14 @@
// 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;
@ -391,14 +431,17 @@
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;
@ -408,12 +451,14 @@
line-height: 86rpx;
color: #fff;
margin: 21rpx auto 0 auto;
&.b-color{
&.b-color {
background-color: var(--view-theme);
}
}
.product-window .joinBnt.on {
background-color: #bbb;
color: #fff;
}
</style>
</style>

View File

@ -356,8 +356,9 @@
<view style='height:120rpx;'></view>
</scroll-view>
</view>
<!-- 组件 -->
<productWindow :attr="attr" :isShow='1' :iSplus='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
<productWindow :attr="attr" :image="image" :isShow='1' :iSplus='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
@ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" id='product-window'>
</productWindow>
<guaranteeTemplate ref="guartemplate" :guarantee='guarantee' :shipping='shipping'></guaranteeTemplate>
@ -488,7 +489,8 @@
indicatorDots: false,
preview_key: '',
comForm: '', // admin
product_attribute: {}
product_attribute: {},
image: ''
};
},
computed: configMap(['hide_mer_status'], mapGetters(['isLogin', 'uid'])),
@ -753,7 +755,11 @@
getPreviewProDetail(params).then(res => {
uni.hideLoading();
let storeInfo = res.data;
this.product_attribute = res.data.product_attribute
// this.product_attribute = res.data.product_attribute
console.log(res.data.product_attribute);
this.image = res.data.image;
if (storeInfo.video_link && storeInfo.slider_image.length > 1) {
this.videoCoverImg = storeInfo.slider_image[0]
storeInfo.slider_image.splice(0, 1)

View File

@ -13,7 +13,7 @@
</u-form-item>
<u-form-item label="商品主图" prop="formData.imageList" ref="item1" required>
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性清晰度</text>
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性清晰度至少上传两张</text>
</u-form-item>
<view class="card" style="min-height: 150rpx;margin-bottom: 0;padding: 0;">
<view class="" style="display: flex;flex-wrap: wrap;">

View File

@ -31,7 +31,7 @@
{{item.store_name}}
</view>
<view class="" style="margin-top: 10rpx;font-size: 24rpx;color: #989898;">
库存 {{item.attrValue[0].stock}}
库存 {{ item.attrValue | stockCount}}
</view>
</view>
@ -40,6 +40,7 @@
style="font-size: 22rpx;"></text><text>{{item.attrValue[0].price}}</text><text
style="color: #828282;">/{{item.attrValue[0].unit_name}}</text>
</view>
<view class="" style="color: #FC452F;font-size: 24rpx;" v-if='isWholeSale'>
<text style="color:#989898">批发</text> <text
style="font-size: 22rpx;"></text><text>{{item.attrValue[0].wholesale_price}}</text><text
@ -260,6 +261,11 @@
components: {
Loading,
},
filters: {
stockCount(value) {
return value.reduce((prev, next) => prev + next.stock, 0);
}
},
data() {
return {
newUser: false,

View File

@ -16,11 +16,12 @@
</view>
<view class="" style="font-size: 24rpx;color: #989898;margin-top: 10rpx;">
<!-- 库存 {{short.attrValue[0].stock}} -->
库存 {{attrvalueStock}}
库存 {{attrvalueStock}}
</view>
</view>
<view class="" style="color: #FC452F;font-size: 24rpx;">
<text style="font-size: 22rpx;"></text><text>10.00</text><text style="color: #828282;">/</text>
<text style="font-size: 22rpx;"></text><text>10.00</text><text
style="color: #828282;">/{{short.attrValue && short.attrValue[0].unit_name}}</text>
</view>
</view>
</view>
@ -128,10 +129,8 @@
initInfo() {
productDetail(this.mer_id, this.short.product_id).then((res) => {
this.short = res.data;
this.attrvalueStock = res.data.attrValue[0].stock
console.log({
...res.data
});
//
this.attrvalueStock = res.data.attrValue.reduce((prev, next) => prev + next.stock, 0);
})
},
onUpdate() {

View File

@ -227,7 +227,7 @@
color: #666666;
.audit-info-txt {
word-break: break-all;
word-break: break-word;
}
}
}