|
|
@ -31,13 +31,13 @@
|
|
|
|
<!-- <text v-if="item.skuItem.dashPrice" class="text2 text-xs"> {{item.skuItem.dashPrice.text}}</text> -->
|
|
|
|
<!-- <text v-if="item.skuItem.dashPrice" class="text2 text-xs"> {{item.skuItem.dashPrice.text}}</text> -->
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="g_left price" v-else>
|
|
|
|
<view class="g_left price" v-if="!item.price">
|
|
|
|
<text class="text1 text-bold text-sm">客服询价 </text>
|
|
|
|
<text class="text1 text-bold text-sm">客服询价 </text>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="g_right" v-if="item.price" @tap="addCart(item)">
|
|
|
|
|
|
|
|
<image src="/static/images/new/jiagou.png" style=" width: 24px;height: 24px;" mode="aspectFill"></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- <view class="g_right" @tap="addCart(item)">
|
|
|
|
|
|
|
|
<image src="/static/images/new/jiagou.png" style=" width: 28px;height: 28px;" mode="aspectFill"></image>
|
|
|
|
|
|
|
|
</view> -->
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
@ -52,13 +52,13 @@
|
|
|
|
<image :src="good_item.picUrl" style="width: 100%;" class="h-100" mode="aspectFit"></image>
|
|
|
|
<image :src="good_item.picUrl" style="width: 100%;" class="h-100" mode="aspectFit"></image>
|
|
|
|
<image :src="'/static/images/new/tag'+index+'.png'" class="cboardVO_tag" mode="aspectFit"></image>
|
|
|
|
<image :src="'/static/images/new/tag'+index+'.png'" class="cboardVO_tag" mode="aspectFit"></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="h-100 flex flex-wrap flex-direction justify-center" style="width: 50%;">
|
|
|
|
<view class="h-100 flex flex-wrap flex-direction justify-center" style="width: 50%;">
|
|
|
|
<view class="w-100 priceColor">{{good_item.sellPrice.text}}</view>
|
|
|
|
<view class="w-100 priceColor">{{good_item.sellPrice.text}}</view>
|
|
|
|
<view class="w-100 text-gray text-sm padding-top-xs">日售{{good_item.dailySales}}</view>
|
|
|
|
<view class="w-100 text-gray text-sm padding-top-xs">日售{{good_item.dailySales}}</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
</view> -->
|
|
|
|
</view> -->
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
@ -72,7 +72,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import { setTabBarBadge } from '@/utils/util.js'
|
|
|
|
import { setTabBarBadge } from '@/utils/util.js'
|
|
|
|
import {getCart, setCart ,resetCart, getCartNumber,setGoodsData,
|
|
|
|
import {getCart, setCart ,resetCart, getCartNumber,setGoodsData,
|
|
|
|
setCartDetails,
|
|
|
|
setCartDetails,
|
|
|
|
setGoodsDetails,getToken} from '@/utils/auth.js'
|
|
|
|
setGoodsDetails,getToken} from '@/utils/auth.js'
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
@ -116,90 +116,57 @@
|
|
|
|
url: '/pages/views/goods/goodsDetails?id=' + item.id
|
|
|
|
url: '/pages/views/goods/goodsDetails?id=' + item.id
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
addCart(e) {
|
|
|
|
addCart(item) {
|
|
|
|
console.log(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 此处应该判断是否登录 如果没登录 跳转到登录页
|
|
|
|
|
|
|
|
if(!getToken()){
|
|
|
|
if(!getToken()){
|
|
|
|
uni.navigateTo({ //登录
|
|
|
|
uni.navigateTo({ //登录
|
|
|
|
url:'/pages/login/index1'
|
|
|
|
url:'/pages/login/index1'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setCartDetails(e.skuItem)
|
|
|
|
if (!item.ifSale) {
|
|
|
|
|
|
|
|
this.$toast('该商品已下架')
|
|
|
|
setGoodsDetails(e.skuItem)
|
|
|
|
return
|
|
|
|
var data = this.good_data
|
|
|
|
|
|
|
|
data.status= 0;
|
|
|
|
|
|
|
|
data.img = e.skuItem.picUrl;
|
|
|
|
|
|
|
|
data.title = e.skuItem.skuTitle.text;
|
|
|
|
|
|
|
|
data.money = parseFloat(e.skuItem.sellPrice.text.substr(1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.imgList.push(e.skuItem.picUrl);
|
|
|
|
|
|
|
|
data.imgList.push(e.skuItem.detailPagePic);
|
|
|
|
|
|
|
|
data.xiaoliang = e.skuItem.skuId;
|
|
|
|
|
|
|
|
data.goods_id = e.skuItem.skuId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(data.skuArr){
|
|
|
|
|
|
|
|
let sku = data.skuArr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let i=0;i<sku.length;i++){
|
|
|
|
|
|
|
|
sku[i].img = data.img
|
|
|
|
|
|
|
|
sku[i].goods_sku_text = data.title+"测试规格"+i;
|
|
|
|
|
|
|
|
sku[i].money = data.money
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(data.sku){
|
|
|
|
|
|
|
|
let sku = data.sku[0].child
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let i=0;i<sku.length;i++){
|
|
|
|
|
|
|
|
sku[i].imgs = data.img
|
|
|
|
|
|
|
|
sku[i].tagname = data.title+"测试规格"+i;
|
|
|
|
|
|
|
|
sku[i].money = data.money
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.selectSku.goods_sku_text = data.skuArr[0].goods_sku_text
|
|
|
|
const cartList = getCart()
|
|
|
|
data.selectSku.img = data.skuArr[0].img
|
|
|
|
item.imgList = item.url.split(',')
|
|
|
|
data.selectSku.money = data.skuArr[0].money
|
|
|
|
item.number = 1
|
|
|
|
|
|
|
|
item._selectedSku = [{
|
|
|
|
|
|
|
|
id: item.id,
|
|
|
|
let colCart = getCart();
|
|
|
|
imgs: '',
|
|
|
|
if(colCart.length){
|
|
|
|
money: item.price,
|
|
|
|
const hasItem = colCart.some(v => v.goods_id === data.goods_id)
|
|
|
|
number: 1,
|
|
|
|
if (!hasItem) {
|
|
|
|
tagname: item.goodsName
|
|
|
|
colCart.push(data)
|
|
|
|
}]
|
|
|
|
} else {
|
|
|
|
item._skus = [
|
|
|
|
for(let y = 0;y < colCart.length; y++){
|
|
|
|
{
|
|
|
|
const item = colCart[y]
|
|
|
|
sku_id: item.id,
|
|
|
|
if (data.goods_id === item.goods_id) {
|
|
|
|
skuname: '规格',
|
|
|
|
item.number ++
|
|
|
|
child: [
|
|
|
|
break
|
|
|
|
{
|
|
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
|
|
imgs: '',
|
|
|
|
|
|
|
|
money: item.price,
|
|
|
|
|
|
|
|
number: 1,
|
|
|
|
|
|
|
|
tagname: item.goodsName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
]
|
|
|
|
colCart = [data]
|
|
|
|
const goodsItem = item
|
|
|
|
|
|
|
|
let hasItem = false
|
|
|
|
|
|
|
|
const cartHasGoodsList = cartList.map(v => {
|
|
|
|
|
|
|
|
if (v.id === (goodsItem.id +'')) {
|
|
|
|
|
|
|
|
hasItem = true
|
|
|
|
|
|
|
|
v.number = v.number >= 99999 ? 99999 : v.number + 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return v
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
if (!hasItem) {
|
|
|
|
|
|
|
|
cartHasGoodsList.push(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resetCart(colCart)
|
|
|
|
resetCart(cartHasGoodsList)
|
|
|
|
/**
|
|
|
|
setTabBarBadge(cartHasGoodsList.length)
|
|
|
|
* 模拟获取购物车的数量 getCart
|
|
|
|
this.$toast('加入购物车成功')
|
|
|
|
*/
|
|
|
|
|
|
|
|
// let cartNum = getCart()
|
|
|
|
|
|
|
|
setTabBarBadge(colCart.length)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 存储商品数据
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
|
|
title: '加入购物车成功 !',
|
|
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -250,12 +217,12 @@
|
|
|
|
width: 50rpx;height: 50rpx;position: absolute;
|
|
|
|
width: 50rpx;height: 50rpx;position: absolute;
|
|
|
|
left: 0;top: 0;
|
|
|
|
left: 0;top: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.loading {
|
|
|
|
.loading {
|
|
|
|
height: 80upx;
|
|
|
|
height: 80upx;
|
|
|
|