Browse Source

下游客户下单

master
tianyi@bogon 3 years ago
parent
commit
419469f8ac
  1. 3
      pages/billing/addUser.vue
  2. 261
      pages/index/downStearmList.vue

3
pages/billing/addUser.vue

@ -5,8 +5,7 @@
<uni-forms ref="form" :modelValue="formData" :rules="rules" labelWidth="85px"> <uni-forms ref="form" :modelValue="formData" :rules="rules" labelWidth="85px">
<uni-forms-item label="姓名" name="consigneeName"> <uni-forms-item label="姓名" name="consigneeName">
<uni-easyinput type="text" v-model="formData.consigneeName" placeholder="请输入人员姓名" <uni-easyinput type="text" v-model="formData.consigneeName" placeholder="请输入人员姓名" />
@blur="nameBlur" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="手机号码" name="consigneeMobile"> <uni-forms-item label="手机号码" name="consigneeMobile">
<uni-easyinput type="number" v-model="formData.consigneeMobile" placeholder="请输入手机号码" /> <uni-easyinput type="number" v-model="formData.consigneeMobile" placeholder="请输入手机号码" />

261
pages/index/downStearmList.vue

@ -14,22 +14,22 @@
<view class="box-right-name">{{item.productName}}</view> <view class="box-right-name">{{item.productName}}</view>
<view class="box-right-num">{{item.productSn}}</view> <view class="box-right-num">{{item.productSn}}</view>
<view class="box-right-price"> <view class="box-right-price">
<view class="price-box"> <!-- <view class="price-box">
<text>{{item.purchasePrice}}</text> <text>{{item.purchasePrice}}</text>
<text>采购价</text> <text>采购价</text>
</view> </view>
<view class="price-box"> <view class="price-box">
<text>{{item.wholesalePrice}}</text> <text>{{item.wholesalePrice}}</text>
<text>批发价</text> <text>批发价</text>
</view> </view> -->
<view class="price-box"> <view class="price-box">
<text>{{item.price}}</text> <text>{{item.price}}</text>
<text>零售价</text> <text>零售价</text>
</view> </view>
<view class="price-box"> <!-- <view class="price-box">
<text>{{item.stockCount}}</text> <text>{{item.stockCount}}</text>
<text>库存</text> <text>库存</text>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
@ -45,7 +45,7 @@
class="uni-tab__dot">{{carList.length}}</text> class="uni-tab__dot">{{carList.length}}</text>
</view> </view>
<view class="bottom-right"> <view class="bottom-right">
<view class="bottom-btn" @tap="backPrevPage">开单</view> <view class="bottom-btn" @tap="clickPrice">开单</view>
</view> </view>
</view> </view>
<!-- 弹出层 --> <!-- 弹出层 -->
@ -66,10 +66,6 @@
</view> </view>
</view> </view>
<view class="popup-container"> <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;"> <ul style="border-top:20rpx;">
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"> <li v-for="(items,index) in goodsDetail.attributeList" :key="index">
<view class="title-fur"> <view class="title-fur">
@ -104,9 +100,29 @@
</uni-popup> </uni-popup>
</view> </view>
<!-- 弹出输入框 --> <!-- 弹出输入框 -->
<uni-popup ref="inputDialog" type="dialog"> <uni-popup ref="inputDialog" background-color="#fff">
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价" <!-- 省市区选择 show:是否显示 @sureSelectArea:确认事件 @hideShow:隐藏事件-->
@confirm="changePrice"></uni-popup-dialog> <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>
<!-- 购物车弹出层 --> <!-- 购物车弹出层 -->
<uni-popup ref="carPopup" background-color="#fff" @change="change"> <uni-popup ref="carPopup" background-color="#fff" @change="change">
@ -144,7 +160,7 @@
<view class="popup-bottom"> <view class="popup-bottom">
<view class="popup-bottom-left"> <view class="popup-bottom-left">
<text>2 款 9 件</text> <text>{{carType}} 款 {{carNum}} 件</text>
</view> </view>
<view class="popup-bottom-right"> <view class="popup-bottom-right">
<view class="bottom-btn" @tap="">选好了</view> <view class="bottom-btn" @tap="">选好了</view>
@ -178,6 +194,58 @@
specsList:[], specsList:[],
evalue:[], 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() { created() {
@ -196,13 +264,12 @@
this.goodsDetail.attributeList[index].value[index1].isChecked = true; this.goodsDetail.attributeList[index].value[index1].isChecked = true;
var name = '', var name = '',
evalue = [], evalue = [],
obj = {}, obj = {}
specsList = []
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) { for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
if (Ien[m].isChecked == true) { if (Ien[m].isChecked == true) {
evalue.push(Ien[m].value) evalue.push(Ien[m].value)
name += Ien[m].value name += Ien[m].value + '/'
} }
} }
} }
@ -223,6 +290,13 @@
name:name, name:name,
price:this.purchasePrice 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) { if (this.temporaryList.length == 0) {
this.temporaryList.push(this.attributeList); this.temporaryList.push(this.attributeList);
} else { } else {
@ -237,20 +311,20 @@
} }
} }
} }
} }
} }
}, },
temporaryChange(val) { temporaryChange(val) {
console.log(val)
this.zNum = 0 this.zNum = 0
console.log(this.temporaryList)
for (var i=0;i<this.temporaryList.length;i++) { for (var i=0;i<this.temporaryList.length;i++) {
this.zNum += this.temporaryList[i].productCount this.zNum += this.temporaryList[i].productCount
} }
this.zPrice = this.zNum * this.purchasePrice this.zPrice = this.zNum * this.purchasePrice
}, },
//编辑每一个的单价
clickPrice() {
this.$refs.inputDialog.open()
},
//获取弹出层状态 //获取弹出层状态
change(e) { change(e) {
console.log('当前模式:' + e.type + ',状态:' + e.show); console.log('当前模式:' + e.type + ',状态:' + e.show);
@ -262,7 +336,10 @@
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
if (type == 'carPopup') { if (type == 'carPopup') {
this.$refs.carPopup.open('bottom') 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 { } else {
this.checkGoods(item); this.checkGoods(item);
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
@ -272,6 +349,7 @@
//选择商品查询商品规格 //选择商品查询商品规格
checkGoods(item) { checkGoods(item) {
this.goodsDetail = item this.goodsDetail = item
this.purchasePrice = item.price;
if (typeof(this.goodsDetail.attributeList) == 'string') { if (typeof(this.goodsDetail.attributeList) == 'string') {
let newObj = JSON.parse(this.goodsDetail.attributeList) let newObj = JSON.parse(this.goodsDetail.attributeList)
let newArr = [] let newArr = []
@ -312,41 +390,32 @@
inputDialogToggle() { inputDialogToggle() {
this.$refs.inputDialog.open() this.$refs.inputDialog.open()
}, },
//临时改价
changePrice(val) {
this.goodsDetail.price = this.temporaryList[0].price = val
},
//弹窗选择规格后,点击弹窗中选好了按钮 //弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() { temporaryCheck() {
if(this.storageType == 0 && this.purchasePrice == 0){ let data = {
uni.showToast({ id: this.goodsDetail.id,
title: "请输入采购价!", price: this.zPrice,
icon: 'none' num: this.zNum,
}) productName: this.goodsDetail.productName,
}else{ productSn: this.goodsDetail.productSn,
let data = { productPicture: this.goodsDetail.productPicture,
id: this.goodsDetail.id, supplierName: this.goodsDetail.supplierName,
price: this.zPrice, saleDetailQueryDTO:this.temporaryList,
num: this.zNum, wholesalePrice:this.goodsDetail.wholesalePrice,
productName: this.goodsDetail.productName, lsprice:this.goodsDetail.price
productSn: this.goodsDetail.productSn, }
productPicture: this.goodsDetail.productPicture, this.carList.push(data)
supplierName: this.goodsDetail.supplierName, this.temporaryList = []
saleDetailQueryDTO:this.temporaryList this.purchasePrice = ''
} this.zPrice = ''
this.carList.push(data) this.zNum = ''
this.temporaryList = [] for(let i=0;i<this.goodsDetail.attributeList.length;i++){
this.purchasePrice = '' this.goodsDetail.attributeList[i].isChecked = false;
this.zPrice = '' for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) {
this.zNum = '' this.goodsDetail.attributeList[i].value[m].isChecked = false
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,45 +455,58 @@
} }
} }
}, },
//点击底部选好了,返回上一页 //点击底部下单按钮
backPrevPage(){ backPrevPage(){
this.specsList.map((item, index) => { let that = this;
this.attributeList[index] = { this.$refs.form.validate().then(res => {
attributeList: JSON.stringify(item), let obj = {
productCount: this.carList[index].num 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) => {
for (var i=0;i<this.carList.length;i++) { if (res.code == 200) {
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{ }else{
this.tui.toast(res.message) 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) { getShareList(id) {
this.tui.request("/app/productShare/getShareList", "POST", { this.tui.request("/app/productShare/getShareList", "POST", {
@ -517,7 +599,14 @@
.title-box { .title-box {
background: #fff; background: #fff;
} }
.popup-pay-content{
align-items: center;
justify-content: center;
padding: 15px;
width: 500rpx;
height: auto;
background-color: #fff;
}
.bottom-box { .bottom-box {
width: 100%; width: 100%;
position: fixed; position: fixed;
@ -651,7 +740,7 @@
.price-box { .price-box {
flex: 1; flex: 1;
text-align: center; text-align: left;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-right: 20rpx; margin-right: 20rpx;

Loading…
Cancel
Save