|
|
|
@ -7,12 +7,13 @@ |
|
|
|
<view class="content-left"> |
|
|
|
<view class="left-box" v-for="(item, index) in indexList" :key="index" |
|
|
|
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)"> |
|
|
|
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;" :class="item.parentId ? 'red' :''">{{item.categoryName}}</text> |
|
|
|
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;" |
|
|
|
:class="item.parentId ? 'red' :''">{{item.categoryName}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="content-right"> |
|
|
|
<view class="right-box" v-for="(item,index) in goodsList" :key="index"> |
|
|
|
<!-- 当商品的delFlag=0和未入库状态时,显示此遮罩,点击弹出弹窗提示不能操作 --> |
|
|
|
<view class="right-box" v-for="(item,index) in goodsList" :key="index"> |
|
|
|
<!-- 当商品的delFlag=0和未入库状态时,显示此遮罩,点击弹出弹窗提示不能操作 --> |
|
|
|
<view class="shop-mask" v-if="item.delFlag == 0" @tap.stop="clickMask(item)"></view> |
|
|
|
<view class="box-left"> |
|
|
|
<img :src="item.productPicture" alt=""> |
|
|
|
@ -64,36 +65,37 @@ |
|
|
|
<!-- 分享弹出层 --> |
|
|
|
<uni-popup ref="share" type="share" @select='select' safeArea backgroundColor="#fff"> |
|
|
|
<uni-popup-share></uni-popup-share> |
|
|
|
</uni-popup> |
|
|
|
<!-- 购物车弹出层 --> |
|
|
|
<uni-popup ref="carPopup" background-color="#fff"> |
|
|
|
<view class="popup-content"> |
|
|
|
<view v-for="(item,index) in gwcList" style="position: relative;" :key="index"> |
|
|
|
<view class="popup-title"> |
|
|
|
<view class="popup-title-left"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/c09dfa8c61c949f8b0dbb8f041d5a501.png" alt=""> |
|
|
|
</view> |
|
|
|
<view class="popup-title-right"> |
|
|
|
<view class="popup-title-right-box" style="color: #088FEB;">{{item.productName}}</view> |
|
|
|
<view class="popup-title-right-box">{{item.productSn}}</view> |
|
|
|
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> |
|
|
|
<text style="margin-right:20rpx;">¥{{item.price}}</text> |
|
|
|
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item.id)"> |
|
|
|
<uni-icons color="red" type="trash" size="26"></uni-icons> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="popup-bottom"> |
|
|
|
<view class="popup-bottom-left"> |
|
|
|
<text>共 {{carType}} 款</text> |
|
|
|
</view> |
|
|
|
<view class="popup-bottom-right"> |
|
|
|
<view class="bottom-btn" @tap="closeCar">关闭</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- 购物车弹出层 --> |
|
|
|
<uni-popup ref="carPopup" background-color="#fff"> |
|
|
|
<view class="popup-content"> |
|
|
|
<view v-for="(item,index) in gwcList" style="position: relative;" :key="index"> |
|
|
|
<view class="popup-title"> |
|
|
|
<view class="popup-title-left"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/c09dfa8c61c949f8b0dbb8f041d5a501.png" |
|
|
|
alt=""> |
|
|
|
</view> |
|
|
|
<view class="popup-title-right"> |
|
|
|
<view class="popup-title-right-box" style="color: #088FEB;">{{item.productName}}</view> |
|
|
|
<view class="popup-title-right-box">{{item.productSn}}</view> |
|
|
|
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> |
|
|
|
<text style="margin-right:20rpx;">¥{{item.price}}</text> |
|
|
|
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item.id)"> |
|
|
|
<uni-icons color="red" type="trash" size="26"></uni-icons> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="popup-bottom"> |
|
|
|
<view class="popup-bottom-left"> |
|
|
|
<text>共 {{carType}} 款</text> |
|
|
|
</view> |
|
|
|
<view class="popup-bottom-right"> |
|
|
|
<view class="bottom-btn" @tap="closeCar">关闭</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
@ -106,18 +108,18 @@ |
|
|
|
indexList: [], |
|
|
|
pageNum: 1, //分页的页码 |
|
|
|
shopList: [], |
|
|
|
info: 0, |
|
|
|
goodsList:[], |
|
|
|
info: 0, |
|
|
|
goodsList: [], |
|
|
|
categoryId: '', //分类id |
|
|
|
searchName: '', //搜索框输入值 |
|
|
|
shopId: '', //店铺id, |
|
|
|
checkbox: '', //需要分享的商品id |
|
|
|
id: '', |
|
|
|
carList:[], |
|
|
|
carNum:0, |
|
|
|
carType:0, |
|
|
|
type:'', |
|
|
|
gwcList:[] |
|
|
|
id: '', |
|
|
|
carList: [], |
|
|
|
carNum: 0, |
|
|
|
carType: 0, |
|
|
|
type: '', |
|
|
|
gwcList: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
@ -129,7 +131,7 @@ |
|
|
|
uni.redirectTo({ |
|
|
|
url: "/pages/index/downStearmList?khid=" + options.khid |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
this.type = uni.getStorageSync('type') |
|
|
|
this.getGategoryList() |
|
|
|
}, |
|
|
|
@ -146,30 +148,30 @@ |
|
|
|
this.indexList[i].parentId = true |
|
|
|
} else { |
|
|
|
this.indexList[i].parentId = false |
|
|
|
} |
|
|
|
} |
|
|
|
this.getShareList(this.indexList[i].id); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}).catch((res) => {}) |
|
|
|
}, |
|
|
|
//点击分类获取商品列表 |
|
|
|
getShareList(id) { |
|
|
|
this.tui.request("/app/product/getShareList", "POST", { |
|
|
|
categoryId: id, |
|
|
|
supplierName: this.searchName, |
|
|
|
pageNum: this.pageNum, |
|
|
|
pageSize: '100' |
|
|
|
}, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
console.log(res.result.records) |
|
|
|
this.shopList.push(res.result.records) |
|
|
|
this.goodsList = this.shopList[0] |
|
|
|
} else { |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
getShareList(id) { |
|
|
|
this.tui.request("/app/product/getShareList", "POST", { |
|
|
|
categoryId: id, |
|
|
|
supplierName: this.searchName, |
|
|
|
pageNum: this.pageNum, |
|
|
|
pageSize: '100' |
|
|
|
}, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
console.log(res.result.records) |
|
|
|
this.shopList.push(res.result.records) |
|
|
|
this.goodsList = this.shopList[0] |
|
|
|
} else { |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}).catch((res) => {}) |
|
|
|
}, |
|
|
|
//顶部搜索框 |
|
|
|
@ -179,20 +181,20 @@ |
|
|
|
title: '搜索:' + res.value, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
}, |
|
|
|
//未入库遮罩 |
|
|
|
clickMask(item){ |
|
|
|
let title = '' |
|
|
|
if(item.delFlag == 0){ |
|
|
|
title = '请将商品上架后再操作!' |
|
|
|
} |
|
|
|
// else if(item.delFlag == 1){ |
|
|
|
// title = '请将商品入库后再操作!' |
|
|
|
// } |
|
|
|
uni.showToast({ |
|
|
|
title: title, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
}, |
|
|
|
//未入库遮罩 |
|
|
|
clickMask(item) { |
|
|
|
let title = '' |
|
|
|
if (item.delFlag == 0) { |
|
|
|
title = '请将商品上架后再操作!' |
|
|
|
} |
|
|
|
// else if(item.delFlag == 1){ |
|
|
|
// title = '请将商品入库后再操作!' |
|
|
|
// } |
|
|
|
uni.showToast({ |
|
|
|
title: title, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
}, |
|
|
|
//点击左侧菜单切换 |
|
|
|
clickLeftBtn(index) { |
|
|
|
@ -202,38 +204,38 @@ |
|
|
|
} else { |
|
|
|
this.indexList[i].parentId = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.goodsList = this.shopList[index] |
|
|
|
// this.getShareList(this.indexList[index].id) |
|
|
|
}, |
|
|
|
//选中商品 |
|
|
|
checkboxChange(item) { |
|
|
|
checkboxChange(item) { |
|
|
|
console.log(item) |
|
|
|
item.checked = !item.checked |
|
|
|
if(this.carList.indexOf(item.id) != -1){ |
|
|
|
this.carList.splice(this.carList.indexOf(item.id),1) |
|
|
|
}else{ |
|
|
|
this.carList.push(item.id) |
|
|
|
} |
|
|
|
if(this.gwcList.length==0){ |
|
|
|
this.gwcList.push(item) |
|
|
|
}else{ |
|
|
|
for(let i=0;i<this.gwcList.length;i++){ |
|
|
|
if(this.gwcList[i].id==item.id){ |
|
|
|
console.log('这里') |
|
|
|
this.gwcList.splice(i,1) |
|
|
|
}else{ |
|
|
|
if(this.gwcList.length == (i+1)){ |
|
|
|
console.log('是不是那里') |
|
|
|
this.gwcList.push(item) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log('gwcList',this.gwcList) |
|
|
|
item.checked = !item.checked |
|
|
|
if (this.carList.indexOf(item.id) != -1) { |
|
|
|
this.carList.splice(this.carList.indexOf(item.id), 1) |
|
|
|
} else { |
|
|
|
this.carList.push(item.id) |
|
|
|
} |
|
|
|
if (this.gwcList.length == 0) { |
|
|
|
this.gwcList.push(item) |
|
|
|
} else { |
|
|
|
for (let i = 0; i < this.gwcList.length; i++) { |
|
|
|
if (this.gwcList[i].id == item.id) { |
|
|
|
console.log('这里') |
|
|
|
this.gwcList.splice(i, 1) |
|
|
|
} else { |
|
|
|
if (this.gwcList.length == (i + 1)) { |
|
|
|
console.log('是不是那里') |
|
|
|
this.gwcList.push(item) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log('gwcList', this.gwcList) |
|
|
|
}, |
|
|
|
//点击分享按钮 |
|
|
|
clickShareBtn(e) { |
|
|
|
@ -280,43 +282,50 @@ |
|
|
|
title: '查看我的推荐', |
|
|
|
path: '/pages/index/shareStyle?khid=' + this.khid |
|
|
|
} |
|
|
|
}, |
|
|
|
//弹出购物车或者商品规格选择弹窗 |
|
|
|
toggle(type, item) { |
|
|
|
this.type = type |
|
|
|
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 |
|
|
|
if (type == 'carPopup') { |
|
|
|
this.$refs.carPopup.open('bottom') |
|
|
|
this.carType = this.carList.length |
|
|
|
} else { |
|
|
|
this.checkGoods(item); |
|
|
|
this.$refs.popup.open('bottom') |
|
|
|
} |
|
|
|
}, |
|
|
|
//删除整条商品 |
|
|
|
delShop(id){ |
|
|
|
var that = this; |
|
|
|
for (let i=0;i<this.shopList.length;i++) { |
|
|
|
if(this.shopList[i].id == id){ |
|
|
|
uni.showModal({ |
|
|
|
title: "提示", |
|
|
|
content: "确定删除此条商品吗?", |
|
|
|
success: function(res) { |
|
|
|
that.carList.splice(that.carList.indexOf(id),1) |
|
|
|
that.carType = that.carList.length |
|
|
|
that.$set(that.shopList[i], 'checked', !that.shopList[i].checked) |
|
|
|
|
|
|
|
console.log(that.carList.length) |
|
|
|
console.log(that.carList) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
//关闭购物车弹窗 |
|
|
|
closeCar(){ |
|
|
|
this.$refs.carPopup.close() |
|
|
|
}, |
|
|
|
//弹出购物车或者商品规格选择弹窗 |
|
|
|
toggle(type, item) { |
|
|
|
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 |
|
|
|
if (type == 'carPopup') { |
|
|
|
this.$refs.carPopup.open('bottom') |
|
|
|
this.carType = this.carList.length |
|
|
|
} else { |
|
|
|
this.checkGoods(item); |
|
|
|
this.$refs.popup.open('bottom') |
|
|
|
} |
|
|
|
}, |
|
|
|
//删除整条商品 |
|
|
|
delShop(id) { |
|
|
|
var that = this; |
|
|
|
uni.showModal({ |
|
|
|
title: "提示", |
|
|
|
content: "确定删除此条商品吗?", |
|
|
|
success: function(res) { |
|
|
|
if (res.confirm) { |
|
|
|
for (let i = 0; i < that.gwcList.length; i++) { |
|
|
|
console.log('匹配吗?',that.goodsList) |
|
|
|
if (that.gwcList[i].id == id) { |
|
|
|
that.carList.splice(that.carList.indexOf(id), 1) |
|
|
|
that.carType = that.carList.length |
|
|
|
that.gwcList.splice(i, 1) |
|
|
|
for(let m= 0;m < that.goodsList.length;m++){ |
|
|
|
if(that.goodsList[m].id == id){ |
|
|
|
that.$set(that.goodsList[m], 'checked', !that.goodsList[m].checked) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
//关闭购物车弹窗 |
|
|
|
closeCar() { |
|
|
|
this.$refs.carPopup.close() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -437,7 +446,7 @@ |
|
|
|
} |
|
|
|
|
|
|
|
.content-right { |
|
|
|
// width: 550rpx; |
|
|
|
// width: 550rpx; |
|
|
|
flex: 1; |
|
|
|
overflow-y: scroll; |
|
|
|
} |
|
|
|
@ -505,80 +514,82 @@ |
|
|
|
.uni-tab__cart-sub-right { |
|
|
|
display: none; |
|
|
|
flex: none; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-content { |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
padding: 15px; |
|
|
|
height: 1200rpx; |
|
|
|
background-color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-right-box { |
|
|
|
height: 50rpx; |
|
|
|
line-height: 50rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-right { |
|
|
|
width: 400rpx; |
|
|
|
margin-left: 30rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-left { |
|
|
|
width: 150rpx; |
|
|
|
height: 150rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-left image { |
|
|
|
width: 150rpx; |
|
|
|
height: 150rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.popup-title { |
|
|
|
display: flex; |
|
|
|
height: 180rpx; |
|
|
|
border-bottom: 1px solid #eee; |
|
|
|
margin-top: 20rpx; |
|
|
|
} |
|
|
|
.popup-bottom { |
|
|
|
width: 100%; |
|
|
|
height: 100rpx; |
|
|
|
position: fixed; |
|
|
|
bottom: 0; |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-bottom-left { |
|
|
|
width: 50%; |
|
|
|
line-height: 80rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-bottom-right { |
|
|
|
width: 50%; |
|
|
|
line-height: 100rpx; |
|
|
|
|
|
|
|
.bottom-btn { |
|
|
|
width: 70%; |
|
|
|
line-height: 35px; |
|
|
|
height: 70rpx; |
|
|
|
text-align: center; |
|
|
|
/* margin-top: 10rpx; */ |
|
|
|
color: #fff; |
|
|
|
font-size: 28rpx; |
|
|
|
margin: 0 auto; |
|
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB); |
|
|
|
border-radius: 70rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
.shop-mask { |
|
|
|
width: 100%; |
|
|
|
height: 190rpx; |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
background: rgba(0, 0, 0, 0.1); |
|
|
|
z-index: 99; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-content { |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
padding: 15px; |
|
|
|
height: 1200rpx; |
|
|
|
background-color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-right-box { |
|
|
|
height: 50rpx; |
|
|
|
line-height: 50rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-right { |
|
|
|
width: 400rpx; |
|
|
|
margin-left: 30rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-left { |
|
|
|
width: 150rpx; |
|
|
|
height: 150rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-title-left image { |
|
|
|
width: 150rpx; |
|
|
|
height: 150rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.popup-title { |
|
|
|
display: flex; |
|
|
|
height: 180rpx; |
|
|
|
border-bottom: 1px solid #eee; |
|
|
|
margin-top: 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-bottom { |
|
|
|
width: 100%; |
|
|
|
height: 100rpx; |
|
|
|
position: fixed; |
|
|
|
bottom: 0; |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-bottom-left { |
|
|
|
width: 50%; |
|
|
|
line-height: 80rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-bottom-right { |
|
|
|
width: 50%; |
|
|
|
line-height: 100rpx; |
|
|
|
|
|
|
|
.bottom-btn { |
|
|
|
width: 70%; |
|
|
|
line-height: 35px; |
|
|
|
height: 70rpx; |
|
|
|
text-align: center; |
|
|
|
/* margin-top: 10rpx; */ |
|
|
|
color: #fff; |
|
|
|
font-size: 28rpx; |
|
|
|
margin: 0 auto; |
|
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB); |
|
|
|
border-radius: 70rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.shop-mask { |
|
|
|
width: 100%; |
|
|
|
height: 190rpx; |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
background: rgba(0, 0, 0, 0.1); |
|
|
|
z-index: 99; |
|
|
|
} |
|
|
|
</style> |