fix: 🐛 优化批发商品购买数量不能小于起批量
parent
2b5f57dfab
commit
a0f1417f42
|
@ -1,63 +1,47 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<u-popup class="popup" v-model="buyMask" :height="setup.height" closeable :mode="setup.mode"
|
<u-popup class="popup" v-model="buyMask" :height="setup.height" closeable :mode="setup.mode" :border-radius="setup.radius" @close="closeMask()">
|
||||||
:border-radius="setup.radius" @close="closeMask()">
|
|
||||||
<!-- 商品 -->
|
<!-- 商品 -->
|
||||||
<view class="goods-box bottom">
|
<view class="goods-box bottom">
|
||||||
<view class="goods-header">
|
<view class="goods-header">
|
||||||
<view class="goods-img">
|
<view class="goods-img">
|
||||||
<u-image width="200rpx" border-radius="20" class="uimage" height="200rpx"
|
<u-image width="200rpx" border-radius="20" class="uimage" height="200rpx" :src="selectedSpecImg ? selectedSpecImg : goodsDetail.thumbnail"></u-image>
|
||||||
:src="selectedSpecImg ? selectedSpecImg : goodsDetail.thumbnail"></u-image>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="goods-skus">
|
<view class="goods-skus">
|
||||||
<!-- 有活动商品价格 -->
|
<!-- 有活动商品价格 -->
|
||||||
<view class="goods-price"
|
<view class="goods-price" v-if="goodsDetail.promotionPrice && ((isGroup && buyType === 'PINTUAN') || !isGroup)">
|
||||||
v-if="goodsDetail.promotionPrice && ((isGroup && buyType === 'PINTUAN') || !isGroup)">
|
|
||||||
<span v-if="goodsDetail.promotionPrice && !pointDetail">
|
<span v-if="goodsDetail.promotionPrice && !pointDetail">
|
||||||
¥
|
¥
|
||||||
<span class="goods-price-promotionShow goods-price-bigshow">{{
|
<span class="goods-price-promotionShow goods-price-bigshow">{{ $options.filters.goodsFormatPrice(goodsDetail.promotionPrice)[0] }}</span>
|
||||||
$options.filters.goodsFormatPrice(goodsDetail.promotionPrice)[0]
|
|
||||||
}}</span>
|
|
||||||
.{{ $options.filters.goodsFormatPrice(goodsDetail.promotionPrice)[1] }}
|
.{{ $options.filters.goodsFormatPrice(goodsDetail.promotionPrice)[1] }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="pointDetail.points">
|
<span v-if="pointDetail.points">
|
||||||
<span class="goods-price-promotionShow goods-price-bigshow">{{
|
<span class="goods-price-promotionShow goods-price-bigshow">{{ pointDetail.points }}</span>
|
||||||
pointDetail.points
|
|
||||||
}}</span>
|
|
||||||
积分
|
积分
|
||||||
</span>
|
</span>
|
||||||
<div class="promotion-box">
|
<div class="promotion-box">
|
||||||
¥
|
¥
|
||||||
<span class="goods-price-bigshow">{{
|
<span class="goods-price-bigshow">{{ $options.filters.goodsFormatPrice(goodsDetail.price)[0] }}</span>
|
||||||
$options.filters.goodsFormatPrice(goodsDetail.price)[0]
|
|
||||||
}}</span>
|
|
||||||
.{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
|
.{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
<!-- 正常商品的价格 -->
|
<!-- 正常商品的价格 -->
|
||||||
<view v-else>
|
<view v-else>
|
||||||
|
|
||||||
<!-- 批发价格 -->
|
<!-- 批发价格 -->
|
||||||
<div class='price-row flex' v-if="goodsDetail.salesModel === 'WHOLESALE'">
|
<div class="price-row flex" v-if="goodsDetail.salesModel === 'WHOLESALE'">
|
||||||
<div class='goods-price' v-for="(item, index) in wholesaleList" :key="index">
|
<div class="goods-price" v-for="(item, index) in wholesaleList" :key="index">
|
||||||
<span>
|
<span>
|
||||||
¥
|
¥
|
||||||
<span class="goods-price-bigshow">{{
|
<span class="goods-price-bigshow">{{ $options.filters.goodsFormatPrice(item.price)[0] }}</span>
|
||||||
$options.filters.goodsFormatPrice(item.price)[0]
|
|
||||||
}}</span>
|
|
||||||
.{{ $options.filters.goodsFormatPrice(item.price)[1] }}
|
.{{ $options.filters.goodsFormatPrice(item.price)[1] }}
|
||||||
</span>
|
</span>
|
||||||
<span class='wholesale-item'>
|
<span class="wholesale-item">{{ item.num }}{{ goodsDetail.goodsUnit }}</span>
|
||||||
{{ item.num }}{{ goodsDetail.goodsUnit }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="goods-price" v-else>
|
<div class="goods-price" v-else>
|
||||||
<span>
|
<span>
|
||||||
¥
|
¥
|
||||||
<span class="goods-price-bigshow">{{
|
<span class="goods-price-bigshow">{{ $options.filters.goodsFormatPrice(goodsDetail.price)[0] }}</span>
|
||||||
$options.filters.goodsFormatPrice(goodsDetail.price)[0]
|
|
||||||
}}</span>
|
|
||||||
.{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
|
.{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -85,16 +69,27 @@
|
||||||
<view class="view-class-title">{{ spec.name }}</view>
|
<view class="view-class-title">{{ spec.name }}</view>
|
||||||
|
|
||||||
<!-- 正常逻辑 循环出sku -->
|
<!-- 正常逻辑 循环出sku -->
|
||||||
<view v-if="!parentOrder" :class="{ active: spec_val.value == currentSelceted[specIndex] }"
|
<view
|
||||||
class="skus-view-item" v-for="(spec_val, spec_index) in spec.values" :key="spec_index"
|
v-if="!parentOrder"
|
||||||
@click="handleClickSpec(spec, specIndex, spec_val)">{{ spec_val.value }}
|
:class="{ active: spec_val.value == currentSelceted[specIndex] }"
|
||||||
|
class="skus-view-item"
|
||||||
|
v-for="(spec_val, spec_index) in spec.values"
|
||||||
|
:key="spec_index"
|
||||||
|
@click="handleClickSpec(spec, specIndex, spec_val)"
|
||||||
|
>
|
||||||
|
{{ spec_val.value }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 拼团购买,仅筛选出当前拼团类型商品 -->
|
<!-- 拼团购买,仅筛选出当前拼团类型商品 -->
|
||||||
<view v-if="parentOrder && spec_val.skuId == goodsDetail.id"
|
<view
|
||||||
:class="{ active: spec_val.value == currentSelceted[specIndex] }" class="skus-view-item"
|
v-if="parentOrder && spec_val.skuId == goodsDetail.id"
|
||||||
v-for="(spec_val, spec_index) in spec.values" :key="spec_index"
|
:class="{ active: spec_val.value == currentSelceted[specIndex] }"
|
||||||
@click="handleClickSpec(spec, specIndex, spec_val)">{{ spec_val.value }}
|
class="skus-view-item"
|
||||||
|
v-for="(spec_val, spec_index) in spec.values"
|
||||||
|
:key="spec_index"
|
||||||
|
@click="handleClickSpec(spec, specIndex, spec_val)"
|
||||||
|
>
|
||||||
|
{{ spec_val.value }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -102,14 +97,12 @@
|
||||||
<view class="goods-skus-number flex flex-a-c flex-j-sb">
|
<view class="goods-skus-number flex flex-a-c flex-j-sb">
|
||||||
<view class="view-class-title">数量</view>
|
<view class="view-class-title">数量</view>
|
||||||
|
|
||||||
<u-input class="view-class-input" input-align="right" v-model="num" type="number"
|
<u-input class="view-class-input" input-align="right" v-model="num" type="number" @blur="numCheck()" @change="numChange()" />
|
||||||
@change="numChange()" />
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 按钮 -->
|
<!-- 按钮 -->
|
||||||
<view class="btns">
|
<view class="btns">
|
||||||
<view class="box-btn card" v-if="buyType != 'PINTUAN' && goodsDetail.goodsType != 'VIRTUAL_GOODS'"
|
<view class="box-btn card" v-if="buyType != 'PINTUAN' && goodsDetail.goodsType != 'VIRTUAL_GOODS'" @click="addToCartOrBuy('cart')">加入购物车</view>
|
||||||
@click="addToCartOrBuy('cart')">加入购物车</view>
|
|
||||||
<view class="box-btn buy" @click="addToCartOrBuy('buy')">立即购买</view>
|
<view class="box-btn buy" @click="addToCartOrBuy('buy')">立即购买</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -117,67 +110,74 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import * as API_trade from "@/api/trade.js";
|
import * as API_trade from '@/api/trade.js';
|
||||||
import setup from "./popup";
|
import setup from './popup';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
setup,
|
setup,
|
||||||
num: 1,
|
num: this.wholesaleList && this.wholesaleList.length > 0 ? this.wholesaleList[0].num : 1,
|
||||||
|
|
||||||
selectName: "", //选中商品的昵称
|
selectName: '', //选中商品的昵称
|
||||||
selectSkuList: "", //选中商铺sku,
|
selectSkuList: '', //选中商铺sku,
|
||||||
selectedSpecImg: "", //选中的图片路径
|
selectedSpecImg: '', //选中的图片路径
|
||||||
buyType: "", //用于存储促销,拼团等活动类型
|
buyType: '', //用于存储促销,拼团等活动类型
|
||||||
parentOrder: "", //父级拼团活动的数据 - 如果是团员则有数据
|
parentOrder: '', //父级拼团活动的数据 - 如果是团员则有数据
|
||||||
formatList: [],
|
formatList: [],
|
||||||
currentSelceted: [],
|
currentSelceted: [],
|
||||||
skuList: "",
|
skuList: '',
|
||||||
isClose: false, //是否可以点击遮罩关闭
|
isClose: false //是否可以点击遮罩关闭
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
wholesaleList: {
|
wholesaleList: {
|
||||||
type: null,
|
type: null,
|
||||||
default: false,
|
default: false
|
||||||
},
|
},
|
||||||
buyMask: {
|
buyMask: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false
|
||||||
},
|
},
|
||||||
isGroup: {
|
isGroup: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false
|
||||||
},
|
},
|
||||||
goodsDetail: {
|
goodsDetail: {
|
||||||
default: "",
|
default: '',
|
||||||
type: null,
|
type: null
|
||||||
},
|
},
|
||||||
selectedSku: {
|
selectedSku: {
|
||||||
default: "",
|
default: '',
|
||||||
type: null,
|
type: null
|
||||||
},
|
},
|
||||||
goodsSpec: {
|
goodsSpec: {
|
||||||
default: "",
|
default: '',
|
||||||
type: null,
|
type: null
|
||||||
},
|
},
|
||||||
addr: {
|
addr: {
|
||||||
default: "",
|
default: '',
|
||||||
type: null,
|
type: null
|
||||||
},
|
},
|
||||||
pointDetail: {
|
pointDetail: {
|
||||||
default: "",
|
default: '',
|
||||||
type: null,
|
type: null
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
wholesalePrice(key) {
|
wholesalePrice(key) {
|
||||||
return this.wholesaleList.length ? this.wholesaleList.map(item => { return item.price }) : []
|
return this.wholesaleList.length
|
||||||
|
? this.wholesaleList.map(item => {
|
||||||
|
return item.price;
|
||||||
|
})
|
||||||
|
: [];
|
||||||
},
|
},
|
||||||
wholesaleNum(key) {
|
wholesaleNum(key) {
|
||||||
return this.wholesaleList.length ? this.wholesaleList.map(item => { return item.num }) : []
|
return this.wholesaleList.length
|
||||||
|
? this.wholesaleList.map(item => {
|
||||||
|
return item.num;
|
||||||
|
})
|
||||||
|
: [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -186,10 +186,9 @@ export default {
|
||||||
//超过库存后修改回库存
|
//超过库存后修改回库存
|
||||||
if (val > this.goodsDetail.quantity) {
|
if (val > this.goodsDetail.quantity) {
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function() {
|
||||||
this.num = this.goodsDetail.quantity
|
this.num = this.goodsDetail.quantity;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buyType: {
|
buyType: {
|
||||||
|
@ -198,32 +197,44 @@ export default {
|
||||||
this.buyType = val;
|
this.buyType = val;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true
|
||||||
},
|
},
|
||||||
selectSkuList: {
|
selectSkuList: {
|
||||||
handler(val, oldval) {
|
handler(val, oldval) {
|
||||||
this.$emit("changed", val);
|
this.$emit('changed', val);
|
||||||
},
|
|
||||||
deep: true,
|
|
||||||
},
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
numCheck(val) {
|
||||||
|
if (this.wholesaleList && this.wholesaleList.length > 0) {
|
||||||
|
if (this.num <= this.wholesaleList[0].num) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '批发商品购买数量不能小于起批数量!',
|
||||||
|
duration: 2000,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
this.num = this.wholesaleList[0].num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
closeMask() {
|
closeMask() {
|
||||||
this.$emit("closeBuy", false);
|
this.$emit('closeBuy', false);
|
||||||
},
|
},
|
||||||
numChange() {
|
numChange() {
|
||||||
if (this.num > this.goodsDetail.quantity) {
|
if (this.num > this.goodsDetail.quantity) {
|
||||||
alert(1)
|
alert(1);
|
||||||
this.num = this.goodsDetail.quantity
|
this.num = this.goodsDetail.quantity;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**点击规格 */
|
/**点击规格 */
|
||||||
handleClickSpec(val, index, specValue) {
|
handleClickSpec(val, index, specValue) {
|
||||||
this.currentSelceted[index] = specValue.value;
|
this.currentSelceted[index] = specValue.value;
|
||||||
let selectedSkuId = this.goodsSpec.find((i) => {
|
let selectedSkuId = this.goodsSpec.find(i => {
|
||||||
let matched = true;
|
let matched = true;
|
||||||
let specValues = i.specValues.filter((j) => j.specName !== "images");
|
let specValues = i.specValues.filter(j => j.specName !== 'images');
|
||||||
for (let n = 0; n < specValues.length; n++) {
|
for (let n = 0; n < specValues.length; n++) {
|
||||||
if (specValues[n].specValue !== this.currentSelceted[n]) {
|
if (specValues[n].specValue !== this.currentSelceted[n]) {
|
||||||
matched = false;
|
matched = false;
|
||||||
|
@ -239,21 +250,21 @@ export default {
|
||||||
this.selectSkuList = {
|
this.selectSkuList = {
|
||||||
spec: {
|
spec: {
|
||||||
specName: val.name,
|
specName: val.name,
|
||||||
specValue: specValue.value,
|
specValue: specValue.value
|
||||||
},
|
},
|
||||||
data: this.goodsDetail,
|
data: this.goodsDetail
|
||||||
};
|
};
|
||||||
this.selectName = specValue.value;
|
this.selectName = specValue.value;
|
||||||
|
|
||||||
this.$emit("handleClickSku", {
|
this.$emit('handleClickSku', {
|
||||||
skuId: selectedSkuId.skuId,
|
skuId: selectedSkuId.skuId,
|
||||||
goodsId: this.goodsDetail.goodsId,
|
goodsId: this.goodsDetail.goodsId
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "暂无该商品!",
|
title: '暂无该商品!',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -262,13 +273,10 @@ export default {
|
||||||
* 直接购买
|
* 直接购买
|
||||||
*/
|
*/
|
||||||
buy(data) {
|
buy(data) {
|
||||||
API_trade.addToCart(data).then((res) => {
|
API_trade.addToCart(data).then(res => {
|
||||||
if (res.data.success) {
|
if (res.data.success) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/order/fillorder?way=${data.cartType
|
url: `/pages/order/fillorder?way=${data.cartType}&addr=${''}&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`
|
||||||
}&addr=${""}&parentOrder=${encodeURIComponent(
|
|
||||||
JSON.stringify(this.parentOrder)
|
|
||||||
)}`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -280,43 +288,42 @@ export default {
|
||||||
addToCartOrBuy(val) {
|
addToCartOrBuy(val) {
|
||||||
if (!this.selectSkuList) {
|
if (!this.selectSkuList) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请选择规格商品",
|
title: '请选择规格商品',
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let data = {
|
let data = {
|
||||||
skuId: this.goodsDetail.id,
|
skuId: this.goodsDetail.id,
|
||||||
num: this.num,
|
num: this.num
|
||||||
};
|
};
|
||||||
|
|
||||||
if (val == "cart") {
|
if (val == 'cart') {
|
||||||
API_trade.addToCart(data).then((res) => {
|
API_trade.addToCart(data).then(res => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "商品已添加到购物车",
|
title: '商品已添加到购物车',
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$emit("queryCart");
|
this.$emit('queryCart');
|
||||||
this.closeMask();
|
this.closeMask();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 判断是否拼团商品
|
// 判断是否拼团商品
|
||||||
if (this.buyType) {
|
if (this.buyType) {
|
||||||
data.cartType = "PINTUAN";
|
data.cartType = 'PINTUAN';
|
||||||
} else if (this.goodsDetail.goodsType == "VIRTUAL_GOODS") {
|
} else if (this.goodsDetail.goodsType == 'VIRTUAL_GOODS') {
|
||||||
data.cartType = "VIRTUAL";
|
data.cartType = 'VIRTUAL';
|
||||||
} else {
|
} else {
|
||||||
data.cartType = "BUY_NOW";
|
data.cartType = 'BUY_NOW';
|
||||||
}
|
}
|
||||||
|
|
||||||
API_trade.addToCart(data).then((res) => {
|
API_trade.addToCart(data).then(res => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/order/fillorder?way=${data.cartType}&addr=${this.addr.id || ""
|
url: `/pages/order/fillorder?way=${data.cartType}&addr=${this.addr.id || ''}&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`
|
||||||
}&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -327,7 +334,7 @@ export default {
|
||||||
let arr = [{}];
|
let arr = [{}];
|
||||||
|
|
||||||
if (!Array.isArray(list)) {
|
if (!Array.isArray(list)) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
list.forEach((item, index) => {
|
list.forEach((item, index) => {
|
||||||
item.specValues.forEach((spec, specIndex) => {
|
item.specValues.forEach((spec, specIndex) => {
|
||||||
|
@ -335,9 +342,9 @@ export default {
|
||||||
let values = {
|
let values = {
|
||||||
value: spec.specValue,
|
value: spec.specValue,
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
skuId: item.skuId,
|
skuId: item.skuId
|
||||||
};
|
};
|
||||||
if (name === "images") {
|
if (name === 'images') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,20 +352,20 @@ export default {
|
||||||
if (
|
if (
|
||||||
arrItem.name == name &&
|
arrItem.name == name &&
|
||||||
arrItem.values &&
|
arrItem.values &&
|
||||||
!arrItem.values.find((i) => {
|
!arrItem.values.find(i => {
|
||||||
return i.value === values.value;
|
return i.value === values.value;
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
arrItem.values.push(values);
|
arrItem.values.push(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
let keys = arr.map((key) => {
|
let keys = arr.map(key => {
|
||||||
return key.name;
|
return key.name;
|
||||||
});
|
});
|
||||||
if (!keys.includes(name)) {
|
if (!keys.includes(name)) {
|
||||||
arr.push({
|
arr.push({
|
||||||
name: name,
|
name: name,
|
||||||
values: [values],
|
values: [values]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -368,11 +375,11 @@ export default {
|
||||||
arr.shift();
|
arr.shift();
|
||||||
this.formatList = arr;
|
this.formatList = arr;
|
||||||
|
|
||||||
list.forEach((item) => {
|
list.forEach(item => {
|
||||||
// 默认选中
|
// 默认选中
|
||||||
if (item.skuId === this.goodsDetail.id) {
|
if (item.skuId === this.goodsDetail.id) {
|
||||||
item.specValues
|
item.specValues
|
||||||
.filter((i) => i.specName !== "images")
|
.filter(i => i.specName !== 'images')
|
||||||
.forEach((value, _index) => {
|
.forEach((value, _index) => {
|
||||||
this.currentSelceted[_index] = value.specValue;
|
this.currentSelceted[_index] = value.specValue;
|
||||||
|
|
||||||
|
@ -380,7 +387,7 @@ export default {
|
||||||
|
|
||||||
this.selectSkuList = {
|
this.selectSkuList = {
|
||||||
spec: value,
|
spec: value,
|
||||||
data: this.goodsDetail,
|
data: this.goodsDetail
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -388,20 +395,19 @@ export default {
|
||||||
|
|
||||||
this.skuList = list;
|
this.skuList = list;
|
||||||
// console.log(" this.skuList", this.skuList)
|
// console.log(" this.skuList", this.skuList)
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.formatSku(this.goodsSpec);
|
this.formatSku(this.goodsSpec);
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "./popup.scss";
|
@import './popup.scss';
|
||||||
|
|
||||||
.price-row {
|
.price-row {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.buy {
|
.buy {
|
||||||
|
@ -430,7 +436,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
> .view-class-input {
|
> .view-class-input {
|
||||||
flex: 1
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +515,6 @@ export default {
|
||||||
> * {
|
> * {
|
||||||
color: $price-color;
|
color: $price-color;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,67 +1,36 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view
|
<view v-for="(promotionItem, promotionIndex) in promotion" :key="promotionIndex" class="promotion_row" @click="shutMask(1)">
|
||||||
v-for="(promotionItem, promotionIndex) in promotion"
|
|
||||||
:key="promotionIndex"
|
|
||||||
class="promotion_row"
|
|
||||||
@click="shutMask(1)"
|
|
||||||
>
|
|
||||||
<view v-if="res != null" v-for="(item, index) in Object.keys(res)" :key="index">
|
<view v-if="res != null" v-for="(item, index) in Object.keys(res)" :key="index">
|
||||||
<div
|
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'FULL_DISCOUNT'">
|
||||||
class="promotion_col"
|
|
||||||
v-if="
|
|
||||||
item.split('-')[0] == promotionItem.value &&
|
|
||||||
item.split('-')[0] == 'FULL_DISCOUNT'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<!-- 满减,折扣 -->
|
<!-- 满减,折扣 -->
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<view class="deg_tag">{{ promotionItem.title }}</view>
|
<view class="deg_tag">{{ promotionItem.title }}</view>
|
||||||
<div class="text proText">满{{ res[item].fullMoney }}元,立享优惠</div>
|
<div class="text proText">满{{ res[item].fullMoney }}元,立享优惠</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'PINTUAN'">
|
||||||
class="promotion_col"
|
|
||||||
v-if="
|
|
||||||
item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'PINTUAN'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<!-- 拼团 -->
|
<!-- 拼团 -->
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<view class="deg_tag">{{ promotionItem.title }}</view>
|
<view class="deg_tag">{{ promotionItem.title }}</view>
|
||||||
<div class="text proText">{{ res[item].promotionName }}</div>
|
<div class="text proText">{{ res[item].promotionName }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'POINTS_GOODS'">
|
||||||
class="promotion_col"
|
|
||||||
v-if="
|
|
||||||
item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'POINTS_GOODS'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<!-- 积分活动 -->
|
<!-- 积分活动 -->
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<view class="deg_tag">{{ promotionItem.title }}</view>
|
<view class="deg_tag">{{ promotionItem.title }}</view>
|
||||||
<div class="text proText">{{ res[item].promotionName }}</div>
|
<div class="text proText">{{ res[item].promotionName }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'KANJIA'">
|
||||||
class="promotion_col"
|
|
||||||
v-if="
|
|
||||||
item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'KANJIA'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<!-- 砍价活动 -->
|
<!-- 砍价活动 -->
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<view class="deg_tag">{{ promotionItem.title }}</view>
|
<view class="deg_tag">{{ promotionItem.title }}</view>
|
||||||
<div class="text proText"></div>
|
<div class="text proText"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'SECKILL'">
|
||||||
class="promotion_col"
|
|
||||||
v-if="
|
|
||||||
item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'SECKILL'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<!-- 限时抢购 -->
|
<!-- 限时抢购 -->
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<view class="deg_tag">{{ promotionItem.title }}</view>
|
<view class="deg_tag">{{ promotionItem.title }}</view>
|
||||||
|
@ -70,14 +39,12 @@
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="promotion_row" style="display: inline">
|
<view class="promotion_row">
|
||||||
<view>
|
<view>
|
||||||
<div class="promotion_col coupon" v-if="couponList && promotionIndex == 1">
|
<div class="promotion_col coupon" v-if="couponList && promotionIndex == 1">
|
||||||
<!-- 优惠券 -->
|
<!-- 优惠券 -->
|
||||||
|
|
||||||
<div>
|
<div><view class="deg_tag">优惠券</view></div>
|
||||||
<view class="deg_tag">优惠券</view>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -88,45 +55,45 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import promotion from "./promotion_type";
|
import promotion from './promotion_type';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
promotion,
|
promotion,
|
||||||
couponList: "",
|
couponList: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
// 父组件传递回来的数据
|
// 父组件传递回来的数据
|
||||||
res: {
|
res: {
|
||||||
type: null,
|
type: null,
|
||||||
default: {},
|
default: {}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
res: {
|
res: {
|
||||||
handler() {
|
handler() {
|
||||||
if (this.res && this.res.length != 0 && this.res != null) {
|
if (this.res && this.res.length != 0 && this.res != null) {
|
||||||
Object.keys(this.res).forEach((item) => {
|
Object.keys(this.res).forEach(item => {
|
||||||
let key = item.split("-")[0];
|
let key = item.split('-')[0];
|
||||||
this.res[item].__key = key;
|
this.res[item].__key = key;
|
||||||
|
|
||||||
if (item.split("-")[0] == "COUPON") {
|
if (item.split('-')[0] == 'COUPON') {
|
||||||
this.couponList = "COUPON";
|
this.couponList = 'COUPON';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
// 此方法条用父级方法
|
// 此方法条用父级方法
|
||||||
shutMask(val) {
|
shutMask(val) {
|
||||||
this.$emit("shutMasks", val);
|
this.$emit('shutMasks', val);
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -147,8 +114,6 @@ export default {
|
||||||
margin: 10rpx 0;
|
margin: 10rpx 0;
|
||||||
}
|
}
|
||||||
.promotion_row {
|
.promotion_row {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
.flex {
|
.flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -164,4 +129,7 @@ export default {
|
||||||
/deep/ .u-mode-light-error {
|
/deep/ .u-mode-light-error {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
.coupon{
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue