Browse Source

开单

master
tianyi@bogon 3 years ago
parent
commit
61c07a4eca
  1. 2
      pages/billing/addUser.vue
  2. 64
      pages/billing/changeGoods1.vue
  3. 65
      pages/inventory/changeGoods1.vue
  4. 65
      pages/inventory/goodsList1.vue

2
pages/billing/addUser.vue

@ -22,7 +22,7 @@
</uni-forms>
<view class="tui-tabbar">
<view class="tui-btn-mr">
<u-button type="error" :plain="true" shape="circle" @tap.stop="del()">删除人员</u-button>
<u-button type="error" :plain="true" shape="circle" v-if="type=='edit'" @tap.stop="del()">删除人员</u-button>
</view>
<view class="tui-btn-mr">
<u-button type="primary" :plain="true" shape="circle" @tap.stop="submit()">提交</u-button>

64
pages/billing/changeGoods1.vue

@ -343,35 +343,41 @@
},
//选择商品查询商品规格
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;
})
}
checkGoods(item) {
this.tui.request("/app/product/getById/"+item.id, "POST", {}, false, true).then((res) => {
if (res.code == 200) {
this.goodsDetail = res.result
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;
})
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//顶部搜索框

65
pages/inventory/changeGoods1.vue

@ -324,35 +324,42 @@
},
//选择商品查询商品规格
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;
})
}
checkGoods(item) {
this.tui.request("/app/product/getById/"+item.id, "POST", {}, false, true).then((res) => {
if (res.code == 200) {
this.goodsDetail = res.result
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;
})
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//顶部搜索框

65
pages/inventory/goodsList1.vue

@ -30,6 +30,22 @@
<text>添加商品</text>
</u-grid-item>
</u-grid>
</view>
<view class="shop-box">
<view class="content-list">
<view class="list-name" style="width:150rpx">选择价格</view>
<view class="list-val" style="width:560rpx;display: flex;">
<radio-group style="display: flex;">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in priceItems"
:key="item.value">
<view>
<radio :value="item.value" @tap="priceChange(item.value)" :checked="index === priceCurrent" />
</view>
<view>{{item.name}}</view>
</label>
</radio-group>
</view>
</view>
</view>
<view class="shop-box">
<view class="content-list">
@ -50,22 +66,6 @@
</view>
</view>
</view>
<view class="shop-box">
<view class="content-list">
<view class="list-name" style="width:150rpx">选择价格</view>
<view class="list-val" style="width:560rpx;display: flex;">
<radio-group style="display: flex;">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in priceItems"
:key="item.value">
<view>
<radio :value="item.value" @tap="priceChange(item.value)" :checked="index === priceCurrent" />
</view>
<view>{{item.name}}</view>
</label>
</radio-group>
</view>
</view>
</view>
<view class="shop-box" style="border-top:5px solid #eee;" v-for="(value,key) in Array.from(carList)" :key="key">
<view class="shop-name" style="position: relative;">
@ -251,7 +251,7 @@
relPrice: '0', //已付金额
otherExpense: '0', // 其他费用
priceNo: '0', //未付金额
discountNum:10,
discountNum:10, //整体折扣
priceCurrent:'',
value: '',
priceItems:[{
@ -265,11 +265,11 @@
],
items: [{
value: '0',
name: '单品折'
name: '单品'
},
{
value: '1',
name: '整体折'
name: '整体'
}
],
logisticsType: [{
@ -293,7 +293,7 @@
name: '自送'
},
],
discountType:'',
discountType:'', //折扣类型
discountCurrent:'',
current:'',
discCurrent: '', //折扣
@ -344,10 +344,7 @@
.saleDetailQueryDTO[m].productCount)
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
console.log("没有数据")
this.carList.set(this.carList1[i].id, obj)
console.log(this.carList)
// this.lsList.set(this.carList1[i].id, obj)
}
this.carList1 = []
} else { //当前页有数据
@ -355,11 +352,9 @@
if (this.carList.has(this.carList1[i].id) == true) { //商品相同
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i].saleDetailQueryDTO[m].attributeList) == true) { //规格相同
console.log("规格相同")
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i].saleDetailQueryDTO[m].productCount)
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
} else { //规格不同
console.log("规格不同")
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount)
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
@ -395,10 +390,17 @@
this.carList1 = []
}
console.log('carList1', this.carList1)
console.log('carList', this.carList)
this.carList.forEach(function(value, key) {
if(that.priceType == 0){ //零售
value.unitPrice = value.lsprice
}else if(that.priceType == 1){ //批发
value.unitPrice = value.wholesalePrice
}
if(that.discountType == 1){ //整体折扣
value.price = value.unitPrice * 10000 * value.productCount * that.discountNum /10 /10000
}
that.totalAmount += value.productCount
that.shouldPay += value.price
})
this.noPay = this.shouldPay
},
@ -451,6 +453,10 @@
//折扣种类选择
discountChange(e){
let that = this;
// if(this.carList.size == 0){
// this.tui.toast("请先选择商品")
// return
// }
that.shouldPay = 0
this.discountType = e.detail.value;
this.carList.forEach(function(value, key) {
@ -599,6 +605,11 @@
//整体选择是批发价还是零售价
priceChange(e){
let that = this;
// if(this.carList.size == 0){
// this.tui.toast("请先选择商品")
// return
// }
this.priceType = e
this.carList.forEach(function(value, key) {
that.index = value.productId
if(e == 0){ //零售

Loading…
Cancel
Save