Compare commits

..

No commits in common. "ad58591164a846c3884954fa2649c5f494ba5bac" and "916e41e42438c3c949e6939c3790cd27bd5827fe" have entirely different histories.

13 changed files with 72 additions and 140 deletions

View File

@ -5,7 +5,6 @@
:class="['tabItem', selectedTab === index ? 'active2' : '']" @click="selectTab(index, item)"> :class="['tabItem', selectedTab === index ? 'active2' : '']" @click="selectTab(index, item)">
{{ item.category_name }} {{ item.category_name }}
</view> </view>
</view> </view>
<view class="content"> <view class="content">

View File

@ -51,7 +51,7 @@ export default {
color: '请选择', color: '请选择',
show: false, show: false,
// //
colorOptions: ['蓝牌', '黄牌', '黑牌', '白牌', '绿牌', '渐变绿底黑字', '黄绿双拼底黑字'], colorOptions: ['蓝色', '黄色', '黑色', '白色', '绿色', '渐变绿底黑字', '黄绿双拼底黑字'],
// //
selectedColorIndex: -1 selectedColorIndex: -1
}; };

View File

@ -32,7 +32,7 @@ page {
/* 车牌类型标签样式 */ /* 车牌类型标签样式 */
.plate-type-box{ .plate-type-box{
padding: 11rpx 2rpx; padding: 11rpx 2rpx;
/* border: 1rpx solid #1890ff; */ border: 1rpx solid #1890ff;
border-radius: 8rpx; border-radius: 8rpx;
} }

View File

@ -7,11 +7,11 @@
<view class="license-plate"> <view class="license-plate">
<view class="plate-type-box"> <view class="plate-type-box">
<text class="plate-type" :class="{ <text class="plate-type" :class="{
'plate-color-blue': item.car_number_color === '蓝', 'plate-color-blue': item.car_number_color === '蓝',
'plate-color-yellow': item.car_number_color === '黄', 'plate-color-yellow': item.car_number_color === '黄',
'plate-color-black': item.car_number_color === '黑', 'plate-color-black': item.car_number_color === '黑',
'plate-color-white': item.car_number_color === '白', 'plate-color-white': item.car_number_color === '白',
'plate-color-green': item.car_number_color === '绿', 'plate-color-green': item.car_number_color === '绿',
'plate-color-gradient-green': item.car_number_color === '渐变绿底黑字', 'plate-color-gradient-green': item.car_number_color === '渐变绿底黑字',
'plate-color-yellow-green': item.car_number_color === '黄绿双拼底黑字' 'plate-color-yellow-green': item.car_number_color === '黄绿双拼底黑字'
}">{{ item.car_number_color }}</text> }">{{ item.car_number_color }}</text>

View File

@ -158,7 +158,7 @@ export default {
color: '请选择', color: '请选择',
show: false, show: false,
// //
colorOptions: ['蓝牌', '黄牌', '黑牌', '白牌', '绿牌', '渐变绿底黑字', '黄绿双拼底黑字'], colorOptions: ['蓝色', '黄色', '黑色', '白色', '绿色', '渐变绿底黑字', '黄绿双拼底黑字'],
// //
selectedColorIndex: -1, selectedColorIndex: -1,

View File

@ -24,15 +24,15 @@ image {
} }
.isDay { .isDay {
background-color: orangered; background-color: orangered;
height: 35rpx; height: 35rpx;
border-radius: 5rpx; border-radius: 5rpx;
color: white; color: white;
font-size: 22rpx; font-size: 22rpx;
text-align: center; text-align: center;
justify-content: center; justify-content: center;
padding: 5rpx 10rpx; padding: 5rpx 10rpx;
display: flex; display: flex;
} }
.tag { .tag {
@ -188,7 +188,7 @@ image {
margin: 0 20rpx; margin: 0 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
font-weight: 700; font-weight: 700;
display: flex; display: flex;
} }
.Msg { .Msg {
@ -598,17 +598,15 @@ image {
margin: 5rpx 5rpx 0 5rpx; margin: 5rpx 5rpx 0 5rpx;
} }
.itemSizeBox {
margin: 30rpx;
}
.itemSize { .itemSize {
width: 30%;
font-size: 26rpx; font-size: 26rpx;
color: #333; color: #333;
background: #F6F7FB; background: #F6F7FB;
border-radius: 40rpx; border-radius: 40rpx;
padding: 10rpx 15rpx; padding: 10rpx 15rpx;
white-space: nowrap; white-space: nowrap;
margin:20rpx 30rpx;
} }
.itemSize_active { .itemSize_active {
@ -616,14 +614,15 @@ image {
color: #fff; color: #fff;
} }
.itemSize-img { .itemSize-img{
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
margin-right: 30rpx; margin-right: 30rpx;
border-radius: 20rpx; border-radius: 20rpx;
border:1rpx solid red;
} }
.itemSize_top { .itemSize_top{
display: flex; display: flex;
margin-left: 30rpx; margin-left: 30rpx;
} }

View File

@ -39,7 +39,7 @@
{{ item.goods_spec }} / {{ item.goods_unit }} {{ item.goods_spec }} / {{ item.goods_unit }}
</view> </view>
</view> </view>
<view class="GG_rigth" @click="showSizePopup"> <view class="GG_rigth">
{{ info.commodity_goods_info_list.length }}<u-icon size="26rpx" name="arrow-right"></u-icon> {{ info.commodity_goods_info_list.length }}<u-icon size="26rpx" name="arrow-right"></u-icon>
</view> </view>
</view> </view>
@ -297,9 +297,9 @@
<view class="itemSize_price">{{ changePrice }}/</view> <view class="itemSize_price">{{ changePrice }}/</view>
</view> </view>
</view> </view>
<view class="itemSizeBox" v-for="(item, index) in info.commodity_goods_info_list" :key="item.id" <view class="itemSize" v-for="(item, index) in info.commodity_goods_info_list" :key="item.id"
@click="changeGG(item, index)"> @click="changeGG(item, index)" :class="index == currentGGIndex ? 'itemSize_active' : ''">
<text class="itemSize" :class="index == currentGGIndex ? 'itemSize_active' : ''">{{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}</text> {{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}
</view> </view>
</u-popup> </u-popup>
</view> </view>
@ -459,7 +459,7 @@ export default {
console.log("this.currentGG", this.currentGG); console.log("this.currentGG", this.currentGG);
this.currentGGIndex = 0; this.currentGGIndex = 0;
this.changeImg = picUrl + this.currentGG.commodity_pic[0] this.changeImg = this.currentGG.commodity_pic[0]
this.changeName = this.currentGG.goods_alias this.changeName = this.currentGG.goods_alias
this.changePrice = this.currentGG.sales_price this.changePrice = this.currentGG.sales_price
}); });
@ -490,7 +490,7 @@ export default {
count: 0 count: 0
}; };
} }
this.changeImg = picUrl + item.commodity_pic[0] this.changeImg = item.commodity_pic[0]
this.changeName = item.goods_alias this.changeName = item.goods_alias
this.changePrice = item.sales_price this.changePrice = item.sales_price
this.getComment(item.goods_id) this.getComment(item.goods_id)
@ -515,35 +515,20 @@ export default {
addCar() { addCar() {
let that = this; let that = this;
//
const currentGoods = this.info.commodity_goods_info_list[this.currentGGIndex];
//
const currentQuantity = currentGoods.cart_count ? currentGoods.cart_count.count : 0;
const stockQuantity = currentGoods.stock_quantity || 0;
//
if (currentQuantity >= stockQuantity) {
uni.showToast({
title: "库存不足",
icon: "none",
duration: 2000
});
return;
}
// //
let goods_id_and_count = []; let goods_id_and_count = [];
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = { this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
count: currentQuantity + 1, count: 1,
}; };
this.info.commodity_goods_info_list.forEach((item) => { this.info.commodity_goods_info_list.forEach((item) => {
console.log(item.cart_count);
goods_id_and_count.push({ goods_id_and_count.push({
goods_id: item.id, goods_id: item.id,
count: item.cart_count ? item.cart_count.count : 0, count: item.cart_count ? item.cart_count.count : 0,
}); });
}); });
console.log(goods_id_and_count);
// update // update
request(apiArr.updateCar, "POST", { request(apiArr.updateCar, "POST", {
goods_id_and_count, goods_id_and_count,

View File

@ -177,10 +177,7 @@ export default {
}) })
}, },
getShopdetail() { getShopdetail() {
const params = { return request(shopApi.getCar, "POST").then((res) => {
is_group_buy: 1,
}
return request(shopApi.getCar, "POST", params).then((res) => {
this.carNum = res.total; this.carNum = res.total;
// //
this.goodsDetail = [].concat(res.same_day_cart_list, res.normal_cart_list) this.goodsDetail = [].concat(res.same_day_cart_list, res.normal_cart_list)
@ -209,11 +206,7 @@ export default {
}); });
}); });
}, },
toDetail(itemObj) { toDetail(item) {
const item = {
...itemObj,
groupById: itemObj.group_buy_activity_info.id
};
NavgateTo(`/packages/shop/groupPurchaseDetail/index?item=${JSON.stringify(item)}`) NavgateTo(`/packages/shop/groupPurchaseDetail/index?item=${JSON.stringify(item)}`)
}, },
// //
@ -302,10 +295,7 @@ export default {
}, },
// //
shopCar() { shopCar() {
const item = { NavgateTo("../shopCar/index");
is_group_buy: 1,
}
NavgateTo("../shopCar/index?item=" + JSON.stringify(item));
}, },
// //
getEndTheCountdown(endTime) { getEndTheCountdown(endTime) {

View File

@ -328,7 +328,6 @@ export default {
boxshadow1: false, boxshadow1: false,
boxshadow2: false, boxshadow2: false,
id: "", id: "",
groupById: "",
info: "", info: "",
currentIndex: "1", // currentIndex: "1", //
@ -569,11 +568,9 @@ export default {
}, },
// //
getGoodsInfo() { getGoodsInfo() {
const params = { request(apiArr.getGoodsInfo, "POST", {
id: this.id, id: this.id,
group_buy_activity_id: this.groupById }).then((res) => {
}
request(apiArr.getGoodsInfo, "POST", params).then((res) => {
// //
res.commodity_goods_info_list.forEach((item) => { res.commodity_goods_info_list.forEach((item) => {
item.goods_detail_pic = item.goods_detail_pic ? item.goods_detail_pic.split(",") : []; item.goods_detail_pic = item.goods_detail_pic ? item.goods_detail_pic.split(",") : [];
@ -593,14 +590,10 @@ export default {
}); });
} }
const currentTime = new Date().getTime();
// group_buy_activity_info // group_buy_activity_info
if (res.commodity_goods_info_list && Array.isArray(res.commodity_goods_info_list)) { if (res.commodity_goods_info_list && Array.isArray(res.commodity_goods_info_list)) {
res.commodity_goods_info_list = res.commodity_goods_info_list.filter(item => { res.commodity_goods_info_list = res.commodity_goods_info_list.filter(item => {
const startTime = new Date(item.group_buy_goods_activity.group_buy_activity_info?.start_time).getTime(); return item.group_buy_activity_info !== null
const endTime = new Date(item.group_buy_goods_activity.group_buy_activity_info?.end_time).getTime();
return item.group_buy_activity_info !== null && currentTime >= startTime && currentTime <= endTime
}); });
} }
@ -677,10 +670,7 @@ export default {
}, },
getShopCarList() { getShopCarList() {
const params = { return request(apiArr.getCar, "POST", {}).then((res) => {
is_group_buy: 1,
}
return request(apiArr.getCar, "POST", params).then((res) => {
// //
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list) this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
.flatMap(supplier => supplier.commodity_cart_and_goods_model); .flatMap(supplier => supplier.commodity_cart_and_goods_model);
@ -819,7 +809,6 @@ export default {
this.top = meun.top; this.top = meun.top;
this.localHeight = meun.height; this.localHeight = meun.height;
this.id = this.itemObj.commodity_id ? this.itemObj.commodity_id : this.itemObj.id; this.id = this.itemObj.commodity_id ? this.itemObj.commodity_id : this.itemObj.id;
this.groupById = this.itemObj.groupById
if (this.itemObj.commodity_id) { if (this.itemObj.commodity_id) {
this.endTime = this.itemObj.group_buy_activity_info.end_time this.endTime = this.itemObj.group_buy_activity_info.end_time
} else { } else {

View File

@ -168,8 +168,8 @@
</view> </view>
</view> </view>
<!-- 运费 --> <!-- 运费 -->
<!-- <view class="goods-desc" style="margin-top: 10rpx;">运费 {{ <view class="goods-desc" style="margin-top: 10rpx;">运费 {{
item.commodity_goods_info.freight }}</view> --> item.commodity_goods_info.freight }}</view>
</view> </view>
<view class="quantity-control"> <view class="quantity-control">
<view class="decrease-btn" @tap.stop="decreaseQuantity(item)">-</view> <view class="decrease-btn" @tap.stop="decreaseQuantity(item)">-</view>
@ -420,24 +420,14 @@ export default {
} }
}, },
increaseQuantity(item) { increaseQuantity(item) {
console.log("🚀 ~ increaseQuantity ~ item:", item)
const currentTime = new Date().getTime(); const currentTime = new Date().getTime();
const startTime = new Date(item.commodity_goods_info.group_buy_activity_info?.start_time).getTime(); const startTime = new Date(item.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
const endTime = new Date(item.commodity_goods_info.group_buy_activity_info?.end_time).getTime(); const endTime = new Date(item.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
if (item.count >= item.commodity_goods_info.stock_quantity) {
uni.showToast({
title: '库存不足',
icon: 'none'
});
return
}
if (currentTime >= startTime && currentTime <= endTime) { if (currentTime >= startTime && currentTime <= endTime) {
if (item.count == 0) { if (item.count == 0) {
item.count += item.commodity_goods_info.min_order_quantity item.count += item.commodity_goods_info.min_order_quantity
} else { } else {
if (item.count >= item.commodity_goods_info.stock_quantity) { if (item.count == item.commodity_goods_info.total_stock) {
uni.showToast({ uni.showToast({
title: '库存不足', title: '库存不足',
icon: 'none' icon: 'none'
@ -484,11 +474,9 @@ export default {
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime(); const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime(); const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
if (currentTime >= startTime && currentTime <= endTime) { if (currentTime >= startTime && currentTime <= endTime) {
// total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight; total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
total += goods.commodity_goods_info.group_buy_price * goods.count;
} else { } else {
// total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight; total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
total += goods.commodity_goods_info.sales_price * goods.count;
} }
}); });
// //
@ -500,11 +488,9 @@ export default {
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime(); const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime(); const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
if (currentTime >= startTime && currentTime <= endTime) { if (currentTime >= startTime && currentTime <= endTime) {
// total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight; total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
total += goods.commodity_goods_info.group_buy_price * goods.count;
} else { } else {
// total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight; total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
total += goods.commodity_goods_info.sales_price * goods.count;
} }
}); });
// //

View File

@ -320,7 +320,7 @@ page {
overflow: hidden; overflow: hidden;
/* position: relative; */ /* position: relative; */
position: fixed; position: fixed;
z-index: 15; z-index: 999;
padding: 20rpx 10rpx; padding: 20rpx 10rpx;
background-color: #ffffff; background-color: #ffffff;
} }
@ -404,7 +404,7 @@ page {
position: absolute; position: absolute;
left: 0; left: 0;
top: 160rpx; top: 160rpx;
z-index: 20; z-index: 11;
} }
.header2 .slide .slide_con .slide_conBox:nth-child(5n) { .header2 .slide .slide_con .slide_conBox:nth-child(5n) {

View File

@ -33,6 +33,17 @@
<!-- 整体展开的顶部 --> <!-- 整体展开的顶部 -->
<view class="header header2" v-if="topShow"> <view class="header header2" v-if="topShow">
<!-- <view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
<view class="searchBox_left">
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
</view>
<view class="searchBox_ipt">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
mode="aspectFill"></image>
<input type="text" placeholder="输入商品名称" />
</view>
</view> -->
<view class="slide"> <view class="slide">
<view class="slide_con"> <view class="slide_con">
<view v-for="(item, index) in CateList" :key="index" class="slide_conBox" @click="changeCate(item.id)"> <view v-for="(item, index) in CateList" :key="index" class="slide_conBox" @click="changeCate(item.id)">
@ -84,7 +95,7 @@
</view> </view>
</view> </view>
<!-- 右下阴影 --> <!-- 右下阴影 -->
<view class="boxshadow2" v-if="cateListShow" @click="changeCateListShow"></view> <view class="boxshadow2" v-if="cateListShow"></view>
<view class="CateIte"> <view class="CateIte">
<view class="CateInfo" <view class="CateInfo"
@ -301,8 +312,9 @@ export default {
NavgateTo('1') NavgateTo('1')
}, },
changeCate(id) { changeCate(id) {
this.checkItem(0)
// ID // ID
this.currentCategoryId = id; this.currentCategoryId = id;
// id // id
@ -310,7 +322,6 @@ export default {
if (category) { if (category) {
// leftCateListnull // leftCateListnull
this.leftCateList = category.level_two_category || []; this.leftCateList = category.level_two_category || [];
this.tagList1 = category.level_three_category || [];
if (this.leftCateList.length > 0) { if (this.leftCateList.length > 0) {
this.currentLeftCateId = this.leftCateList[0].id; this.currentLeftCateId = this.leftCateList[0].id;
this.secondId = this.leftCateList[0].id; this.secondId = this.leftCateList[0].id;
@ -331,7 +342,7 @@ export default {
this.cateListShow = false this.cateListShow = false
this.rightTopActive = index; this.rightTopActive = index;
// ID // ID
this.selectedTagId = this.tagList[index]?.id; this.selectedTagId = this.tagList[index].id;
}, },
// //
topOpen() { topOpen() {
@ -437,42 +448,26 @@ export default {
}, },
// //
handleQuantityChange(val, item) { handleQuantityChange(val, item) {
//
// valvalue
//
const quantity = typeof val === 'object' && val !== null && 'value' in val ? val.value : val; const quantity = typeof val === 'object' && val !== null && 'value' in val ? val.value : val;
//
let currentQuantity = 0;
let stockQuantity = 0;
let goodsToUpdate = null;
// items.commodity_goods_info_list[0].quantity // items.commodity_goods_info_list[0].quantity
if ( if (
item.commodity_goods_info_list && item.commodity_goods_info_list &&
item.commodity_goods_info_list.length item.commodity_goods_info_list.length
) { ) {
this.goodsId = item.commodity_goods_info_list[0].id; this.goodsId = item.commodity_goods_info_list[0].id;
currentQuantity = item.commodity_goods_info_list[0].quantity || 0; // 使$set
stockQuantity = item.commodity_goods_info_list[0].stock_quantity || 0; this.$set(item.commodity_goods_info_list[0], 'quantity', quantity);
goodsToUpdate = item.commodity_goods_info_list[0];
} }
// ite.quantity // ite.quantity
else { else {
this.goodsId = item.id; this.goodsId = item.id;
currentQuantity = item.quantity || 0; // 使$set
stockQuantity = item.stock_quantity || 0; this.$set(item, 'quantity', quantity);
goodsToUpdate = item;
} }
//
if (quantity > currentQuantity && currentQuantity >= stockQuantity) {
uni.showToast({
title: "库存不足",
icon: 'none'
});
return;
}
// 使$set
this.$set(goodsToUpdate, 'quantity', quantity);
const params = { const params = {
user_id: uni.getStorageSync("userId"), user_id: uni.getStorageSync("userId"),

View File

@ -228,7 +228,7 @@ export default {
isDayshow: false, isDayshow: false,
isParcelPostchecked: false, isParcelPostchecked: false,
parcelPostshow: false, parcelPostshow: false,
is_group_buy: ''
}; };
}, },
// watch: { // watch: {
@ -303,10 +303,7 @@ export default {
// //
getShopCar() { getShopCar() {
const params = { request(apiArr.getCar, "POST", {}).then((res) => {
is_group_buy: this.is_group_buy
}
request(apiArr.getCar, "POST", params).then((res) => {
if (res.normal_cart_list.length > 0) { if (res.normal_cart_list.length > 0) {
res.normal_cart_list.forEach((item) => { res.normal_cart_list.forEach((item) => {
item.checked = false; item.checked = false;
@ -617,13 +614,6 @@ export default {
this.shopCarTotal++; this.shopCarTotal++;
} }
} else { } else {
if (carItem.count >= carItem.commodity_goods_info.stock_quantity) {
uni.showToast({
title: '库存不足',
icon: 'none'
});
return
}
carItem.count++; carItem.count++;
this.shopCarTotal++; this.shopCarTotal++;
} }
@ -727,7 +717,6 @@ export default {
const meun = menuButtonInfo(); const meun = menuButtonInfo();
this.top = meun.top; this.top = meun.top;
this.localHeight = meun.height; this.localHeight = meun.height;
this.is_group_buy = options.item ? JSON.parse(options.item).is_group_buy : ''
this.getShopCar(); this.getShopCar();
}, },
onShow() { onShow() {