3 changed files with 699 additions and 8 deletions
@ -0,0 +1,689 @@ |
|||
<template> |
|||
<view class="page1"> |
|||
<view class="title-box"> |
|||
<uni-search-bar class="uni-mt-10" radius="5" placeholder="请输入商品名称/编号" cancelButton="none" |
|||
@confirm="search" /> |
|||
</view> |
|||
<view class="content-box"> |
|||
<view class="content-right"> |
|||
<view class="right-box" v-for="item in shopList" :key="item" @tap="toggle('bottom',item)"> |
|||
<view class="box-left"> |
|||
<img :src="item.productPicture" alt=""> |
|||
</view> |
|||
<view class="box-right"> |
|||
<view class="box-right-name">{{item.productName}}</view> |
|||
<view class="box-right-num">{{item.productSn}}</view> |
|||
<view class="box-right-price"> |
|||
<view class="price-box"> |
|||
<text>{{item.purchasePrice}}</text> |
|||
<text>采购价</text> |
|||
</view> |
|||
<view class="price-box"> |
|||
<text>{{item.wholesalePrice}}</text> |
|||
<text>批发价</text> |
|||
</view> |
|||
<view class="price-box"> |
|||
<text>{{item.price}}</text> |
|||
<text>零售价</text> |
|||
</view> |
|||
<view class="price-box"> |
|||
<text>{{item.stockCount}}</text> |
|||
<text>库存</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="bottom-box"> |
|||
<view class="bottom-left" @tap="toggle('carPopup')"> |
|||
<view class="bottom-left-box"> |
|||
<uni-icons type="cart" size="20" color="#646566"></uni-icons> |
|||
<text class="uni-tab__text">已选择</text> |
|||
</view> |
|||
<text style="background-color:#ff0000;color:#fff;position: absolute;top: 0;right: 10rpx;" |
|||
class="uni-tab__dot">{{carList.length}}</text> |
|||
</view> |
|||
<view class="bottom-right"> |
|||
<view class="bottom-btn" @tap="backPrevPage">开单</view> |
|||
</view> |
|||
</view> |
|||
<!-- 弹出层 --> |
|||
<view> |
|||
<uni-popup ref="popup" background-color="#fff" @change="change"> |
|||
<view class="popup-content"> |
|||
<view class="popup-title"> |
|||
<view class="popup-title-left"> |
|||
<img src="/static/images/logo.png" alt=""> |
|||
</view> |
|||
<view class="popup-title-right"> |
|||
<view class="popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}} |
|||
</view> |
|||
<view class="popup-title-right-box">{{goodsDetail.barcode}}</view> |
|||
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> |
|||
<text style="margin-right:20rpx;">¥{{goodsDetail.price}}</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="popup-container"> |
|||
<ul> |
|||
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"> |
|||
<view class="title-fur"> |
|||
<view class="name">{{items.name}}</view> |
|||
</view> |
|||
<view class="attrs"> |
|||
<uni-data-checkbox v-model="value" :localdata="range" |
|||
@change="change"></uni-data-checkbox> |
|||
<text v-for="(itemTag, index1) in items.value" :key="index1" |
|||
@tap.stop="attrNameChange(index,index1) " |
|||
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text> |
|||
</view> |
|||
</li> |
|||
</ul> |
|||
<view class="checkList" v-for="item in temporaryList"> |
|||
<view class="checkList-box"> |
|||
{{item.name}} |
|||
</view> |
|||
<uni-number-box :value="item.temporaryNum" @change="temporaryChange" /> |
|||
</view> |
|||
</view> |
|||
<view class="popup-bottom" v-for="item in temporaryList"> |
|||
<view class="popup-bottom-left"> |
|||
<text>{{item.num}} 件</text> |
|||
<text>¥{{item.num * item.price}}</text> |
|||
</view> |
|||
<view class="popup-bottom-right"> |
|||
<view class="bottom-btn" @tap="temporaryCheck">选好了</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</uni-popup> |
|||
</view> |
|||
<!-- 购物车弹出层 --> |
|||
<uni-popup ref="carPopup" background-color="#fff" @change="change"> |
|||
<view class="popup-content"> |
|||
<view v-for="item in carList"> |
|||
|
|||
|
|||
<view class="popup-title"> |
|||
<view class="popup-title-left"> |
|||
<img src="/static/images/logo.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> |
|||
<uni-icons color="#088FEB" type="compose" size="16"></uni-icons> |
|||
<view style="position: absolute;top: 30rpx;right: 30rpx;"> |
|||
<uni-icons color="red" type="trash" size="26"></uni-icons> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
<view class="popup-container"> |
|||
<view class="checkList"> |
|||
<view style="margin-right:5%;"> |
|||
<uni-icons color="red" type="minus" size="26"></uni-icons> |
|||
</view> |
|||
<view class="checkList-box"> |
|||
<text>女装</text> |
|||
<text>S码</text> |
|||
<text>黄色</text> |
|||
</view> |
|||
<uni-number-box :value="numberValue" @change="change" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="popup-bottom"> |
|||
<view class="popup-bottom-left"> |
|||
<text>2 款 9 件</text> |
|||
</view> |
|||
<view class="popup-bottom-right"> |
|||
<view class="bottom-btn" @tap="">选好了</view> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
</uni-popup> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
indexList: [], |
|||
pageNum: 1, //分页的页码 |
|||
shopList: [], |
|||
info: 0, |
|||
categoryId: '', //分类id |
|||
keywords: '', //搜索框输入值 |
|||
shopId: '', //店铺id, |
|||
checkbox: [], //需要分享的商品id |
|||
temporaryNum: 0, |
|||
goodsDetail: [], |
|||
attrNameList: [], |
|||
temporaryList: [], |
|||
carList: [], |
|||
columns: [], |
|||
keyList: [], |
|||
specsList:[], |
|||
evalue:[], |
|||
attributeList:[], |
|||
} |
|||
}, |
|||
onLoad(options) { |
|||
this.khid = options.khid; |
|||
this.getShareList(options.khid); |
|||
}, |
|||
methods: { |
|||
attrNameChange(index, index1) { |
|||
this.goodsDetail.attributeList[index].value.forEach(item => { |
|||
item.isChecked = false; |
|||
}) |
|||
|
|||
this.goodsDetail.attributeList[index].isChecked = true; |
|||
this.goodsDetail.attributeList[index].value[index1].isChecked = true; |
|||
|
|||
var name = '', //选中后弹出层显示的名字 |
|||
evalue = [] //临时储存的数组 |
|||
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { |
|||
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) { |
|||
|
|||
if (Ien[m].isChecked == true) { |
|||
evalue.push(Ien[m].value) |
|||
name += Ien[m].value |
|||
} |
|||
} |
|||
} |
|||
this.evalue = evalue; |
|||
console.log(evalue) |
|||
this.temporaryList = [{ |
|||
id: this.goodsDetail.id, |
|||
barcode: this.goodsDetail.barcode, |
|||
price: this.goodsDetail.price, |
|||
name: name, |
|||
num: this.temporaryNum, |
|||
productName: this.goodsDetail.productName, |
|||
productSn: this.goodsDetail.productSn, |
|||
productPicture:this.goodsDetail.productPicture, |
|||
supplierName:this.goodsDetail.supplierName |
|||
}] |
|||
}, |
|||
temporaryChange(val) { |
|||
|
|||
this.temporaryList[0].num = val |
|||
|
|||
}, |
|||
//点击底部选好了,返回上一页 |
|||
backPrevPage(){ |
|||
this.specsList.map((item, index) => { |
|||
this.attributeList[index] = { |
|||
attributeList: JSON.stringify(item), |
|||
productCount: this.carList[index].num |
|||
} |
|||
}) |
|||
for (var i=0;i<this.carList.length;i++) { |
|||
this.carList[i].saleDetailQueryDTO = this.attributeList[i] |
|||
} |
|||
let obj = { |
|||
sale: { |
|||
area: "丰台区", |
|||
city: "北京", |
|||
province: "北京", |
|||
receiveAddress: "总部基地", |
|||
totalAmount: 100, //应付金额 |
|||
username:'王等等', |
|||
mobile:'13500111001' |
|||
}, |
|||
saleDetailList: [{ |
|||
productId: "1695314088038633472", |
|||
saleDetailQueryDTO: [{ |
|||
attributeList: '{"颜色":"s","尺码":"m"}', |
|||
productCount: 2 |
|||
}] |
|||
}] |
|||
} |
|||
this.tui.request("/app/sale/savePresale", "post", obj, false, false).then((res) => { |
|||
if (res.code == 200) { |
|||
|
|||
|
|||
} |
|||
}) |
|||
|
|||
}, |
|||
//点击分类获取商品列表 |
|||
getShareList(id) { |
|||
this.tui.request("/app/productShare/getShareList", "POST", { |
|||
keywords:this.keywords, |
|||
// id:id, |
|||
id:'1717828137930330112', |
|||
pageNum: this.pageNum, |
|||
pageSize: '10' |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
|
|||
this.shopList = res.result.records |
|||
} else {} |
|||
}).catch((res) => {}) |
|||
}, |
|||
//获取弹出层状态 |
|||
change(e) { |
|||
|
|||
}, |
|||
//弹出购物车或者商品规格选择弹窗 |
|||
toggle(type, item) { |
|||
|
|||
this.type = type |
|||
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 |
|||
if (type == 'carPopup') { |
|||
this.$refs.carPopup.open('bottom') |
|||
} else { |
|||
this.checkGoods(item); |
|||
this.$refs.popup.open('bottom') |
|||
} |
|||
|
|||
}, |
|||
//选择商品查询商品规格 |
|||
checkGoods(item) { |
|||
this.goodsDetail = item |
|||
if (typeof(this.goodsDetail.attributeList) == 'string') { |
|||
let newObj = JSON.parse(this.goodsDetail.attributeList) |
|||
let newArr = [] |
|||
for (let val in newObj) { |
|||
let valueObj = []; |
|||
for (var i = 0; i < newObj[val].length; i++) { |
|||
valueObj.push({ |
|||
value: newObj[val][i], |
|||
isChecked: false |
|||
}) |
|||
this.attrNameList.push({ |
|||
value: newObj[val][i], |
|||
name: val, |
|||
isChecked: false |
|||
}) |
|||
} |
|||
newArr.push({ |
|||
name: val, |
|||
value: valueObj |
|||
}) |
|||
} |
|||
this.goodsDetail.attributeList = newArr; |
|||
this.goodsDetail.attributeList.forEach((item, index) => { |
|||
this.columns[index] = item.value; |
|||
this.keyList[index] = item.name; |
|||
}) |
|||
} |
|||
|
|||
}, |
|||
//顶部搜索框 |
|||
search(res) { |
|||
this.keywords = res.value |
|||
this.getShareList(this.khid) |
|||
}, |
|||
//点击左侧菜单切换 |
|||
clickLeftBtn(index) { |
|||
for (var i = 0; i < this.indexList.length; i++) { |
|||
if (i == index) { |
|||
this.indexList[i].parentId = true |
|||
} else { |
|||
this.indexList[i].parentId = false |
|||
} |
|||
} |
|||
this.getShareList(this.indexList[index].id) |
|||
}, |
|||
inputDialogToggle() { |
|||
this.$refs.inputDialog.open() |
|||
}, |
|||
//临时改价 |
|||
changePrice(val) { |
|||
this.goodsDetail.price = this.temporaryList[0].price = val |
|||
}, |
|||
//弹窗选择规格后,点击弹窗中选好了按钮 |
|||
temporaryCheck() { |
|||
this.carList.push(this.temporaryList[0]); |
|||
this.$refs.popup.close() |
|||
var obj = {}; |
|||
this.keyList.map((item, index) => { |
|||
obj[item] = this.evalue[index] |
|||
}) |
|||
this.specsList.push(obj); |
|||
|
|||
// this.specsList.map((item, index) => { |
|||
// this.attributeList[index] = { |
|||
// attributeList: JSON.stringify(item), |
|||
// productCount: this.numList[index] |
|||
// } |
|||
// }) |
|||
// for (var i =0;i<this.shopList.length;i++) { |
|||
// if(this.shopList[i].id == this.temporaryList[0].id){ |
|||
// this.shopList[i].temporaryList = this.temporaryList[0] |
|||
// } |
|||
// } |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
page { |
|||
height: 100%; |
|||
} |
|||
|
|||
.page1 { |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 92%; |
|||
} |
|||
|
|||
.uni-tab__dot { |
|||
padding: 0 4px; |
|||
line-height: 15px; |
|||
color: #ffffff; |
|||
text-align: center; |
|||
font-size: 12px; |
|||
background-color: #ff0000; |
|||
border-radius: 15px; |
|||
} |
|||
|
|||
.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-container { |
|||
width: 100%; |
|||
background: #fff; |
|||
height: 50rpx; |
|||
} |
|||
|
|||
.uni-tab__text { |
|||
font-size: 12px; |
|||
color: #646566; |
|||
} |
|||
|
|||
.title-box { |
|||
background: #fff; |
|||
} |
|||
|
|||
.bottom-box { |
|||
width: 100%; |
|||
position: fixed; |
|||
bottom: 0; |
|||
display: flex; |
|||
} |
|||
|
|||
.bottom-left { |
|||
width: 15%; |
|||
position: relative; |
|||
} |
|||
|
|||
.bottom-right { |
|||
width: 85%; |
|||
|
|||
.bottom-btn { |
|||
width: 85%; |
|||
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; |
|||
} |
|||
} |
|||
|
|||
.bottom-left-box { |
|||
display: flex; |
|||
flex-direction: column; |
|||
text-align: center; |
|||
} |
|||
|
|||
.content-box { |
|||
background: #fff; |
|||
flex: 1; |
|||
display: flex; |
|||
} |
|||
|
|||
.content-left { |
|||
width: 170rpx; |
|||
background: #eee; |
|||
height: 100%; |
|||
} |
|||
|
|||
.left-box { |
|||
width: 100%; |
|||
height: 90rpx; |
|||
font-size: 30rpx; |
|||
text-align: center; |
|||
line-height: 90rpx; |
|||
border-bottom: 1px solid #fff; |
|||
} |
|||
|
|||
.left-box-hover { |
|||
width: 100%; |
|||
height: 90rpx; |
|||
font-size: 30rpx; |
|||
text-align: center; |
|||
line-height: 90rpx; |
|||
border-bottom: 1px solid #fff; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.red { |
|||
border-right: 3px solid red; |
|||
} |
|||
|
|||
.content-right { |
|||
width: 100%; |
|||
overflow-y: scroll; |
|||
} |
|||
|
|||
.right-box { |
|||
width: 100%; |
|||
height: 220rpx; |
|||
display: flex; |
|||
border-bottom: 1px solid #eee; |
|||
position: relative; |
|||
} |
|||
|
|||
.box-left { |
|||
width: 170rpx; |
|||
height: 170rpx; |
|||
background-size: 100%; |
|||
margin: 25rpx; |
|||
border-radius: 20rpx; |
|||
} |
|||
|
|||
.box-left img { |
|||
width: 100%; |
|||
height: 100%; |
|||
|
|||
} |
|||
|
|||
.box-right { |
|||
margin-top: 17rpx; |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.box-right-name { |
|||
font-size: 30rpx; |
|||
font-weight: bold; |
|||
padding-left: 20rpx; |
|||
height: 30%; |
|||
} |
|||
|
|||
.box-right-num { |
|||
padding: 5rpx 0; |
|||
color: #777; |
|||
padding-left: 20rpx; |
|||
height: 30%; |
|||
} |
|||
|
|||
.box-right-price { |
|||
display: flex; |
|||
font-size: 25rpx; |
|||
} |
|||
|
|||
.checkbox { |
|||
width: 40rpx; |
|||
height: 40rpx; |
|||
position: absolute; |
|||
top: 20rpx; |
|||
right: 30rpx; |
|||
} |
|||
|
|||
.price-box { |
|||
flex: 1; |
|||
text-align: center; |
|||
display: flex; |
|||
flex-direction: column; |
|||
margin-right: 20rpx; |
|||
} |
|||
|
|||
.price-box text:first-child { |
|||
color: #ffa200 |
|||
} |
|||
|
|||
.uni-tab__cart-button-right, |
|||
.uni-tab__cart-sub-right { |
|||
display: none; |
|||
flex: none; |
|||
} |
|||
|
|||
.title-fur { |
|||
width: 95%; |
|||
height: 70rpx; |
|||
margin: 0 auto; |
|||
} |
|||
|
|||
.name { |
|||
font-size: 30rpx; |
|||
width: 50%; |
|||
float: left; |
|||
height: 70rpx; |
|||
line-height: 70rpx; |
|||
} |
|||
|
|||
.content-fur { |
|||
padding-bottom: 25rpx; |
|||
} |
|||
|
|||
.content-low { |
|||
width: auto; |
|||
border: 1px solid #eee; |
|||
display: inline-block; |
|||
min-width: 90rpx; |
|||
padding: 5rpx; |
|||
font-size: 35rpx; |
|||
text-align: center; |
|||
color: #777; |
|||
margin: 20rpx 0 0 20rpx; |
|||
} |
|||
|
|||
.content-low:hover { |
|||
background: #eee; |
|||
} |
|||
|
|||
.checkList { |
|||
display: flex; |
|||
height: 50rpx; |
|||
font-size: 28rpx; |
|||
line-height: 50rpx; |
|||
margin: 20rpx 0; |
|||
} |
|||
|
|||
.checkList-box { |
|||
height: 50rpx; |
|||
width: 60%; |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
} |
|||
|
|||
.attrs { |
|||
text { |
|||
display: inline-block; |
|||
border: 1px solid #5fd9ee; |
|||
margin: 20rpx; |
|||
background-color: #fff; |
|||
color: #5fd9ee; |
|||
width: 100rpx; |
|||
line-height: 70rpx; |
|||
height: 70rpx; |
|||
text-align: center; |
|||
} |
|||
|
|||
.checkedText { |
|||
background-color: $u-primary; |
|||
color: #fff; |
|||
} |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue