|
|
|
@ -14,22 +14,22 @@ |
|
|
|
<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"> |
|
|
|
<!-- <view class="price-box"> |
|
|
|
<text>{{item.purchasePrice}}</text> |
|
|
|
<text>采购价</text> |
|
|
|
</view> |
|
|
|
<view class="price-box"> |
|
|
|
<text>{{item.wholesalePrice}}</text> |
|
|
|
<text>批发价</text> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
<view class="price-box"> |
|
|
|
<text>{{item.price}}</text> |
|
|
|
<text>零售价</text> |
|
|
|
</view> |
|
|
|
<view class="price-box"> |
|
|
|
<!-- <view class="price-box"> |
|
|
|
<text>{{item.stockCount}}</text> |
|
|
|
<text>库存</text> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -45,7 +45,7 @@ |
|
|
|
class="uni-tab__dot">{{carList.length}}</text> |
|
|
|
</view> |
|
|
|
<view class="bottom-right"> |
|
|
|
<view class="bottom-btn" @tap="backPrevPage">开单</view> |
|
|
|
<view class="bottom-btn" @tap="clickPrice">开单</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 弹出层 --> |
|
|
|
@ -66,10 +66,6 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="popup-container"> |
|
|
|
<view class="purchase-price" v-if="storageType == 0"> |
|
|
|
<view style="margin-right: 20rpx;">采购价</view> |
|
|
|
<uni-easyinput type="text" v-model="purchasePrice" placeholder="请输入采购价" /> |
|
|
|
</view> |
|
|
|
<ul style="border-top:20rpx;"> |
|
|
|
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"> |
|
|
|
<view class="title-fur"> |
|
|
|
@ -104,9 +100,29 @@ |
|
|
|
</uni-popup> |
|
|
|
</view> |
|
|
|
<!-- 弹出输入框 --> |
|
|
|
<uni-popup ref="inputDialog" type="dialog"> |
|
|
|
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价" |
|
|
|
@confirm="changePrice"></uni-popup-dialog> |
|
|
|
<uni-popup ref="inputDialog" background-color="#fff"> |
|
|
|
<!-- 省市区选择 show:是否显示 @sureSelectArea:确认事件 @hideShow:隐藏事件--> |
|
|
|
<cc-selectDity :show="show" @sureSelectArea="onsetCity" @hideShow="onhideShow"></cc-selectDity> |
|
|
|
<view class="popup-pay-content"> |
|
|
|
<uni-forms ref="form" :modelValue="formData" :rules="rules" labelWidth="85px"> |
|
|
|
|
|
|
|
<uni-forms-item label="姓名" name="consigneeName"> |
|
|
|
<uni-easyinput type="text" v-model="formData.consigneeName" placeholder="请输入人员姓名" /> |
|
|
|
</uni-forms-item> |
|
|
|
<uni-forms-item label="手机号码" name="consigneeMobile"> |
|
|
|
<uni-easyinput type="number" v-model="formData.consigneeMobile" placeholder="请输入手机号码" /> |
|
|
|
</uni-forms-item> |
|
|
|
<uni-forms-item label="地址" name="address1"> |
|
|
|
<view class="input selectcity" @tap="openPicker"> |
|
|
|
<input placeholder="请选择省市区" disabled type="text" v-model="formData.address1"></input> |
|
|
|
</view> |
|
|
|
</uni-forms-item> |
|
|
|
<uni-forms-item label="详细地址" name="address"> |
|
|
|
<uni-easyinput type="textarea" v-model="formData.address" /> |
|
|
|
</uni-forms-item> |
|
|
|
</uni-forms> |
|
|
|
<view @tap="backPrevPage">开单</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- 购物车弹出层 --> |
|
|
|
<uni-popup ref="carPopup" background-color="#fff" @change="change"> |
|
|
|
@ -144,7 +160,7 @@ |
|
|
|
|
|
|
|
<view class="popup-bottom"> |
|
|
|
<view class="popup-bottom-left"> |
|
|
|
<text>2 款 9 件</text> |
|
|
|
<text>{{carType}} 款 {{carNum}} 件</text> |
|
|
|
</view> |
|
|
|
<view class="popup-bottom-right"> |
|
|
|
<view class="bottom-btn" @tap="">选好了</view> |
|
|
|
@ -177,7 +193,59 @@ |
|
|
|
keyList: [], |
|
|
|
specsList:[], |
|
|
|
evalue:[], |
|
|
|
attributeList:[], |
|
|
|
attributeList:[], |
|
|
|
zNum:0, |
|
|
|
addressObj:{}, |
|
|
|
show:false, |
|
|
|
zPrice:0, |
|
|
|
carType:0, |
|
|
|
carNum:0, |
|
|
|
formData: { |
|
|
|
consigneeMobile: '', |
|
|
|
consigneeName: '', |
|
|
|
address1: '', |
|
|
|
address: '', |
|
|
|
province: '', |
|
|
|
city: '', |
|
|
|
area: '', |
|
|
|
id: '' |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
consigneeName: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请输入姓名', |
|
|
|
}, |
|
|
|
{ |
|
|
|
minLength: 2, |
|
|
|
maxLength: 5, |
|
|
|
errorMessage: '姓名长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
consigneeMobile: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请输入手机号', |
|
|
|
}, { |
|
|
|
minLength: 11, |
|
|
|
maxLength: 11, |
|
|
|
errorMessage: '手机号为11个字符', |
|
|
|
}] |
|
|
|
}, |
|
|
|
address1: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请选择地址', |
|
|
|
}] |
|
|
|
}, |
|
|
|
address: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请输入详细地址', |
|
|
|
}] |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
@ -196,13 +264,12 @@ |
|
|
|
this.goodsDetail.attributeList[index].value[index1].isChecked = true; |
|
|
|
var name = '', |
|
|
|
evalue = [], |
|
|
|
obj = {}, |
|
|
|
specsList = [] |
|
|
|
obj = {} |
|
|
|
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 |
|
|
|
name += Ien[m].value + '/' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -223,6 +290,13 @@ |
|
|
|
name:name, |
|
|
|
price:this.purchasePrice |
|
|
|
} |
|
|
|
|
|
|
|
for(let i=0;i<this.goodsDetail.attributeList.length;i++){ |
|
|
|
this.goodsDetail.attributeList[i].isChecked = false; |
|
|
|
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) { |
|
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.temporaryList.length == 0) { |
|
|
|
this.temporaryList.push(this.attributeList); |
|
|
|
} else { |
|
|
|
@ -237,20 +311,20 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
temporaryChange(val) { |
|
|
|
console.log(val) |
|
|
|
this.zNum = 0 |
|
|
|
console.log(this.temporaryList) |
|
|
|
for (var i=0;i<this.temporaryList.length;i++) { |
|
|
|
this.zNum += this.temporaryList[i].productCount |
|
|
|
} |
|
|
|
this.zPrice = this.zNum * this.purchasePrice |
|
|
|
}, |
|
|
|
//编辑每一个的单价 |
|
|
|
clickPrice() { |
|
|
|
this.$refs.inputDialog.open() |
|
|
|
}, |
|
|
|
//获取弹出层状态 |
|
|
|
change(e) { |
|
|
|
console.log('当前模式:' + e.type + ',状态:' + e.show); |
|
|
|
@ -262,7 +336,10 @@ |
|
|
|
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 |
|
|
|
if (type == 'carPopup') { |
|
|
|
this.$refs.carPopup.open('bottom') |
|
|
|
|
|
|
|
for (let i=0;i<this.carList.length;i++) { |
|
|
|
this.carNum += this.carList[i].num |
|
|
|
} |
|
|
|
this.carType = this.carList.length |
|
|
|
} else { |
|
|
|
this.checkGoods(item); |
|
|
|
this.$refs.popup.open('bottom') |
|
|
|
@ -272,6 +349,7 @@ |
|
|
|
//选择商品查询商品规格 |
|
|
|
checkGoods(item) { |
|
|
|
this.goodsDetail = item |
|
|
|
this.purchasePrice = item.price; |
|
|
|
if (typeof(this.goodsDetail.attributeList) == 'string') { |
|
|
|
let newObj = JSON.parse(this.goodsDetail.attributeList) |
|
|
|
let newArr = [] |
|
|
|
@ -312,41 +390,32 @@ |
|
|
|
inputDialogToggle() { |
|
|
|
this.$refs.inputDialog.open() |
|
|
|
}, |
|
|
|
//临时改价 |
|
|
|
changePrice(val) { |
|
|
|
this.goodsDetail.price = this.temporaryList[0].price = val |
|
|
|
}, |
|
|
|
//弹窗选择规格后,点击弹窗中选好了按钮 |
|
|
|
temporaryCheck() { |
|
|
|
if(this.storageType == 0 && this.purchasePrice == 0){ |
|
|
|
uni.showToast({ |
|
|
|
title: "请输入采购价!", |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
let data = { |
|
|
|
id: this.goodsDetail.id, |
|
|
|
price: this.zPrice, |
|
|
|
num: this.zNum, |
|
|
|
productName: this.goodsDetail.productName, |
|
|
|
productSn: this.goodsDetail.productSn, |
|
|
|
productPicture: this.goodsDetail.productPicture, |
|
|
|
supplierName: this.goodsDetail.supplierName, |
|
|
|
saleDetailQueryDTO:this.temporaryList |
|
|
|
} |
|
|
|
this.carList.push(data) |
|
|
|
this.temporaryList = [] |
|
|
|
this.purchasePrice = '' |
|
|
|
this.zPrice = '' |
|
|
|
this.zNum = '' |
|
|
|
for(let i=0;i<this.goodsDetail.attributeList.length;i++){ |
|
|
|
this.goodsDetail.attributeList[i].isChecked = false; |
|
|
|
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) { |
|
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false |
|
|
|
} |
|
|
|
let data = { |
|
|
|
id: this.goodsDetail.id, |
|
|
|
price: this.zPrice, |
|
|
|
num: this.zNum, |
|
|
|
productName: this.goodsDetail.productName, |
|
|
|
productSn: this.goodsDetail.productSn, |
|
|
|
productPicture: this.goodsDetail.productPicture, |
|
|
|
supplierName: this.goodsDetail.supplierName, |
|
|
|
saleDetailQueryDTO:this.temporaryList, |
|
|
|
wholesalePrice:this.goodsDetail.wholesalePrice, |
|
|
|
lsprice:this.goodsDetail.price |
|
|
|
} |
|
|
|
this.carList.push(data) |
|
|
|
this.temporaryList = [] |
|
|
|
this.purchasePrice = '' |
|
|
|
this.zPrice = '' |
|
|
|
this.zNum = '' |
|
|
|
for(let i=0;i<this.goodsDetail.attributeList.length;i++){ |
|
|
|
this.goodsDetail.attributeList[i].isChecked = false; |
|
|
|
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) { |
|
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false |
|
|
|
} |
|
|
|
this.$refs.popup.close() |
|
|
|
} |
|
|
|
this.$refs.popup.close() |
|
|
|
|
|
|
|
}, |
|
|
|
//删除整条商品 |
|
|
|
@ -386,44 +455,57 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
//点击底部选好了,返回上一页 |
|
|
|
//点击底部下单按钮 |
|
|
|
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", |
|
|
|
stockLogList1: [{ |
|
|
|
attributeList: '{"颜色":"s","尺码":"m"}', |
|
|
|
productCount: 2 |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
this.tui.request("/app/sale/savePresale", "post", obj, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
this.tui.toast(res.message) |
|
|
|
let that = this; |
|
|
|
this.$refs.form.validate().then(res => { |
|
|
|
let obj = { |
|
|
|
sale: { |
|
|
|
area: this.addressObj.area, |
|
|
|
city: this.addressObj.city, |
|
|
|
province: this.addressObj.province, |
|
|
|
receiveAddress: that.formData.address, |
|
|
|
totalAmount: that.zPrice, //应付金额 |
|
|
|
username:that.formData.consigneeName, |
|
|
|
mobile:that.formData.consigneeMobile |
|
|
|
}, |
|
|
|
saleDetailList: this.carList |
|
|
|
} |
|
|
|
this.tui.request("/app/sale/savePresale", "post", obj, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
console.log('表单错误信息:', err); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
openPicker() { |
|
|
|
console.log('执行打开地址选择器') |
|
|
|
this.show = true |
|
|
|
}, |
|
|
|
|
|
|
|
onhideShow() { |
|
|
|
this.show = false |
|
|
|
console.log('执行了关闭地址选择器') |
|
|
|
}, |
|
|
|
//选中省市区 |
|
|
|
onsetCity(e) { |
|
|
|
let data = e.detail.target.dataset; |
|
|
|
let address = data.province + data.city + data.area; |
|
|
|
this.show = false |
|
|
|
this.formData.address1 = address; |
|
|
|
this.addressObj = { |
|
|
|
province: data.province, |
|
|
|
city: data.city, |
|
|
|
area: data.area, |
|
|
|
} |
|
|
|
|
|
|
|
console.log(this.formData, this.addressObj); |
|
|
|
}, |
|
|
|
//点击分类获取商品列表 |
|
|
|
getShareList(id) { |
|
|
|
@ -517,7 +599,14 @@ |
|
|
|
.title-box { |
|
|
|
background: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-pay-content{ |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
padding: 15px; |
|
|
|
width: 500rpx; |
|
|
|
height: auto; |
|
|
|
background-color: #fff; |
|
|
|
} |
|
|
|
.bottom-box { |
|
|
|
width: 100%; |
|
|
|
position: fixed; |
|
|
|
@ -651,7 +740,7 @@ |
|
|
|
|
|
|
|
.price-box { |
|
|
|
flex: 1; |
|
|
|
text-align: center; |
|
|
|
text-align: left; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
margin-right: 20rpx; |
|
|
|
|