|
|
|
@ -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){ //零售 |
|
|
|
|