dengrui/components/twocoluList.vue

74 lines
2.5 KiB
Vue
Raw Normal View History

2021-08-26 01:49:06 +00:00
<template>
<view class="padding-zy20 disba flw">
<view v-if="dataList.length!=0" class="discc radius10 padding20 margin-x20" v-for="(item,index) in dataList" :key="index"
style="background-color: #FFFFFF;width: 43%;box-shadow: 0 0 30rpx rgba(0,0,0,0.1);">
<image @tap="goDetail(item.spu_id)" class="pimg radius10 margin-s10" :src="item.src" mode="aspectFill"></image>
<view class="clips2 margin-s10 width100" style="font-size: 27rpx;height: 68rpx;text-align: left;">{{item.title}}</view>
<view class="disba width100 margin-sx10">
<view class="disac fon24 colorf78">
<view><text class="fon36 bold">{{item.price}}</text>.00</view>
2021-09-08 00:46:00 +00:00
<view v-if="user_type=='personal'" class="flexs radius16 colorb fon24 margin-z10" style="background-color: #4cc474;line-height: 30rpx;height: 30rpx;">
<view style="transform: scale(0.7);">全国零售</view>
</view>
2021-08-26 01:49:06 +00:00
<view class="flexs radius16 colorb fon24 margin-z10" style="background-color: #4cc474;line-height: 30rpx;height: 30rpx;">
2021-09-08 00:46:00 +00:00
<view style="transform: scale(0.7);">放心购</view>
2021-08-26 01:49:06 +00:00
</view>
</view>
2021-08-27 08:01:51 +00:00
<image v-if="user_type!='personal'" @tap="addChe(item.id)" class="pche" src="/static/img/public/gouwcar.png"></image>
2021-08-26 01:49:06 +00:00
</view>
</view>
<view v-if="dataList.length==0" class="kongk width100 text-center"></view>
</view>
</template>
<script>
export default {
props:{
dataList:{
type:Array,
default:function(){
return []
}
}
},
data() {
return {
2021-08-27 08:01:51 +00:00
user_type:uni.getStorageSync('user_type')//权限
2021-08-26 01:49:06 +00:00
};
},
2021-08-27 09:04:04 +00:00
mounted() {
},
2021-08-26 01:49:06 +00:00
methods:{
addChe(id){//加入购物车事件
// console.log(this.dataList);
if(uni.getStorageSync('is_active')==0) {
this.$toolAll.tools.showToast('您目前是游客,请授权登录')
setTimeout(()=>{
uni.navigateTo({url:'/pages/login/login'})
},1500)
} else {
this.$emit('addChe')
this.$requst.post('order/shopping-cart-add',{sku_id:id,num:1}).then(res=>{
if(res.code==0){
this.$toolAll.tools.showToast('添加购物车成功(*^▽^*)')
2021-08-28 06:23:27 +00:00
} else {
this.$toolAll.tools.showToast(res.msg)
2021-08-26 01:49:06 +00:00
}
},error=>{})
}
},
goDetail(index){
// console.log('进入详情页'+index);
uni.navigateTo({
url:'/pagesA/productDetail/productDetail?id='+index
})
}
},
}
</script>
<style>
</style>