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> </uni-forms>
<view class="tui-tabbar"> <view class="tui-tabbar">
<view class="tui-btn-mr"> <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>
<view class="tui-btn-mr"> <view class="tui-btn-mr">
<u-button type="primary" :plain="true" shape="circle" @tap.stop="submit()">提交</u-button> <u-button type="primary" :plain="true" shape="circle" @tap.stop="submit()">提交</u-button>

64
pages/billing/changeGoods1.vue

@ -343,35 +343,41 @@
}, },
//选择商品查询商品规格 //选择商品查询商品规格
checkGoods(item) { checkGoods(item) {
this.goodsDetail = item this.tui.request("/app/product/getById/"+item.id, "POST", {}, false, true).then((res) => {
if (typeof(this.goodsDetail.attributeList) == 'string') { if (res.code == 200) {
let newObj = JSON.parse(this.goodsDetail.attributeList) this.goodsDetail = res.result
let newArr = [] if (typeof(this.goodsDetail.attributeList) == 'string') {
for (let val in newObj) { let newObj = JSON.parse(this.goodsDetail.attributeList)
let valueObj = []; let newArr = []
for (var i = 0; i < newObj[val].length; i++) { for (let val in newObj) {
valueObj.push({ let valueObj = [];
value: newObj[val][i], for (var i = 0; i < newObj[val].length; i++) {
isChecked: false valueObj.push({
}) value: newObj[val][i],
this.attrNameList.push({ isChecked: false
value: newObj[val][i], })
name: val, this.attrNameList.push({
isChecked: false value: newObj[val][i],
}) name: val,
} isChecked: false
newArr.push({ })
name: val, }
value: valueObj newArr.push({
}) name: val,
} value: valueObj
this.goodsDetail.attributeList = newArr; })
this.goodsDetail.attributeList.forEach((item, index) => { }
this.columns[index] = item.value; this.goodsDetail.attributeList = newArr;
this.keyList[index] = item.name; 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) { checkGoods(item) {
this.goodsDetail = item this.tui.request("/app/product/getById/"+item.id, "POST", {}, false, true).then((res) => {
if (typeof(this.goodsDetail.attributeList) == 'string') { if (res.code == 200) {
let newObj = JSON.parse(this.goodsDetail.attributeList) this.goodsDetail = res.result
let newArr = [] if (typeof(this.goodsDetail.attributeList) == 'string') {
for (let val in newObj) { let newObj = JSON.parse(this.goodsDetail.attributeList)
let valueObj = []; let newArr = []
for (var i = 0; i < newObj[val].length; i++) { for (let val in newObj) {
valueObj.push({ let valueObj = [];
value: newObj[val][i], for (var i = 0; i < newObj[val].length; i++) {
isChecked: false valueObj.push({
}) value: newObj[val][i],
this.attrNameList.push({ isChecked: false
value: newObj[val][i], })
name: val, this.attrNameList.push({
isChecked: false value: newObj[val][i],
}) name: val,
} isChecked: false
newArr.push({ })
name: val, }
value: valueObj newArr.push({
}) name: val,
} value: valueObj
this.goodsDetail.attributeList = newArr; })
this.goodsDetail.attributeList.forEach((item, index) => { }
this.columns[index] = item.value; this.goodsDetail.attributeList = newArr;
this.keyList[index] = item.name; 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> <text>添加商品</text>
</u-grid-item> </u-grid-item>
</u-grid> </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>
<view class="shop-box"> <view class="shop-box">
<view class="content-list"> <view class="content-list">
@ -50,22 +66,6 @@
</view> </view>
</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>
<view class="shop-box" style="border-top:5px solid #eee;" v-for="(value,key) in Array.from(carList)" :key="key"> <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;"> <view class="shop-name" style="position: relative;">
@ -251,7 +251,7 @@
relPrice: '0', //已付金额 relPrice: '0', //已付金额
otherExpense: '0', // 其他费用 otherExpense: '0', // 其他费用
priceNo: '0', //未付金额 priceNo: '0', //未付金额
discountNum:10, discountNum:10, //整体折扣
priceCurrent:'', priceCurrent:'',
value: '', value: '',
priceItems:[{ priceItems:[{
@ -265,11 +265,11 @@
], ],
items: [{ items: [{
value: '0', value: '0',
name: '单品折' name: '单品'
}, },
{ {
value: '1', value: '1',
name: '整体折' name: '整体'
} }
], ],
logisticsType: [{ logisticsType: [{
@ -293,7 +293,7 @@
name: '自送' name: '自送'
}, },
], ],
discountType:'', discountType:'', //折扣类型
discountCurrent:'', discountCurrent:'',
current:'', current:'',
discCurrent: '', //折扣 discCurrent: '', //折扣
@ -344,10 +344,7 @@
.saleDetailQueryDTO[m].productCount) .saleDetailQueryDTO[m].productCount)
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
} }
console.log("没有数据")
this.carList.set(this.carList1[i].id, obj) this.carList.set(this.carList1[i].id, obj)
console.log(this.carList)
// this.lsList.set(this.carList1[i].id, obj)
} }
this.carList1 = [] this.carList1 = []
} else { //当前页有数据 } else { //当前页有数据
@ -355,11 +352,9 @@
if (this.carList.has(this.carList1[i].id) == true) { //商品相同 if (this.carList.has(this.carList1[i].id) == true) { //商品相同
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { 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) { //规格相同 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).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 this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
} else { //规格不同 } else { //规格不同
console.log("规格不同")
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount)
this.carList.get(this.carList1[i].id).productCount += 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 = [] this.carList1 = []
} }
console.log('carList1', this.carList1)
console.log('carList', this.carList)
this.carList.forEach(function(value, key) { 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.totalAmount += value.productCount
that.shouldPay += value.price
}) })
this.noPay = this.shouldPay this.noPay = this.shouldPay
}, },
@ -451,6 +453,10 @@
//折扣种类选择 //折扣种类选择
discountChange(e){ discountChange(e){
let that = this; let that = this;
// if(this.carList.size == 0){
// this.tui.toast("请先选择商品")
// return
// }
that.shouldPay = 0 that.shouldPay = 0
this.discountType = e.detail.value; this.discountType = e.detail.value;
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
@ -599,6 +605,11 @@
//整体选择是批发价还是零售价 //整体选择是批发价还是零售价
priceChange(e){ priceChange(e){
let that = this; let that = this;
// if(this.carList.size == 0){
// this.tui.toast("请先选择商品")
// return
// }
this.priceType = e
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
that.index = value.productId that.index = value.productId
if(e == 0){ //零售 if(e == 0){ //零售

Loading…
Cancel
Save