|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<view class="cart">
|
|
|
<view class="manage">
|
|
|
- <view>管理</view>
|
|
|
+ <view @click="handlerManage">管理</view>
|
|
|
<!-- <view>退出管理</view> -->
|
|
|
</view>
|
|
|
<!-- 列表 -->
|
|
@@ -23,7 +23,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item-r">
|
|
|
- <u-number-box v-model="item.quantity" @change="valChange"></u-number-box>
|
|
|
+ <u-number-box v-model="item.quantity" @change="valChange(item,$event)"></u-number-box>
|
|
|
</view>
|
|
|
</view>
|
|
|
</u-checkbox-group>
|
|
@@ -35,31 +35,37 @@
|
|
|
<u-checkbox-group shape='circle' v-model="isAllSecect" @change='isAllChange'>
|
|
|
<u-checkbox label="全部" name='0'> </u-checkbox>
|
|
|
</u-checkbox-group>
|
|
|
- <view class="bottom-price">
|
|
|
+ <view class="bottom-price" v-show="!manageShow">
|
|
|
<view>
|
|
|
<text style="font-size: 22rpx; color: #333">合计:</text>
|
|
|
<text style="font-size: 22rpx">¥</text>
|
|
|
<text style="font-size: 34rpx; font-weight: 800">{{ allPrice.sum }}</text>
|
|
|
</view>
|
|
|
- <view class="favorable chelvc-flex">
|
|
|
+ <view class="favorable chelvc-flex" >
|
|
|
<text style="margin-right: 10rpx">
|
|
|
已优惠
|
|
|
<text style="font-weight: 800">¥255</text>
|
|
|
</text>
|
|
|
- <view class="chelvc-flex">
|
|
|
+ <view class="chelvc-flex" @click="instructionShow = true">
|
|
|
<text style="margin-right: 5rpx">优惠明细</text>
|
|
|
<u-icon name="arrow-up" color="#fe7b21" size="12" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="settleAccount" @click="handlerSettleBill">结算( {{ allPrice.goodsNumber }} )</view>
|
|
|
+ <view class="settleAccount" @click="handlerSettleBill"> {{ !manageShow ? `结算( ${allPrice.goodsNumber} )` : `删除( ${allPrice.goodsNumber} ) ` }} </view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <u-popup :show="instructionShow" mode='bottom' @close="instructionShow = false" round='20'>
|
|
|
+ <view class='pop-box'>
|
|
|
+ <text>出淤泥而不染,濯清涟而不妖</text>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- getShoppingCart
|
|
|
+ getShoppingCart,deleteCartItem,editGoodsNumb,generateConfirmOrder
|
|
|
} from "@/api/client/business.js"
|
|
|
export default {
|
|
|
data() {
|
|
@@ -67,39 +73,42 @@
|
|
|
init_list: [],
|
|
|
isAllSecect: [], //checkbox是否全选
|
|
|
goodsCheckbox: [], //checkbox选择商品
|
|
|
- sumPrice:0
|
|
|
+ sumPrice: 0,
|
|
|
+ instructionShow:false ,// 底部优惠明细
|
|
|
+
|
|
|
+ manageShow:false
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
this.handlerInitList()
|
|
|
},
|
|
|
- watch:{
|
|
|
- goodsCheckbox(newValue){
|
|
|
- if(newValue.length == this.init_list.length){
|
|
|
+ watch: {
|
|
|
+ goodsCheckbox(newValue) {
|
|
|
+ if (newValue.length == this.init_list.length) {
|
|
|
this.isAllSecect.push("0")
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.isAllSecect = []
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- computed:{
|
|
|
- allPrice(){
|
|
|
+ computed: {
|
|
|
+ allPrice() {
|
|
|
let sum = 0
|
|
|
let goodsNumber = 0
|
|
|
- this.goodsCheckbox.map(rs=>{
|
|
|
- this.init_list.map(rc=>{
|
|
|
- if(rs == rc.goodsId){
|
|
|
+ this.goodsCheckbox.map(rs => {
|
|
|
+ this.init_list.map(rc => {
|
|
|
+ if (rs == rc.goodsId) {
|
|
|
rc.allPrice = Number((rc.price * rc.quantity).toFixed(2))
|
|
|
sum += rc.allPrice
|
|
|
goodsNumber += rc.quantity
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
- return { sum , goodsNumber}
|
|
|
+ return {
|
|
|
+ sum,
|
|
|
+ goodsNumber
|
|
|
+ }
|
|
|
},
|
|
|
- allNum(){
|
|
|
-
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
// 初始化购物车列表1
|
|
@@ -110,21 +119,46 @@
|
|
|
},
|
|
|
// 结算按钮
|
|
|
handlerSettleBill() {
|
|
|
- console.log('@@@@111', 1);
|
|
|
+ if(this.manageShow){
|
|
|
+ deleteCartItem({ids:this.goodsCheckbox}).then(res=>{
|
|
|
+ console.log('@@@@res',res)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ // this.goodsCheckbox.map(rs=>{
|
|
|
+ // this.init_list.map(rc=>{
|
|
|
+ // if(rs == rc.goodsId){
|
|
|
+ // console.log('rc',rc)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+
|
|
|
+ generateConfirmOrder({cartIds:this.goodsCheckbox,payType:2}).then(res=>{
|
|
|
+ console.log('@@@@res',res)
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
- valChange() {},
|
|
|
+ valChange(item,e) {
|
|
|
+ editGoodsNumb(item.goodsId,{ quantity:e.value }).then(res=>{
|
|
|
+ console.log('@@@2res',res)
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
// 是否多选
|
|
|
- isAllChange(e){
|
|
|
- if(e.length){
|
|
|
+ isAllChange(e) {
|
|
|
+ if (e.length) {
|
|
|
this.goodsCheckbox = []
|
|
|
- this.init_list.map(rs=>{
|
|
|
+ this.init_list.map(rs => {
|
|
|
this.goodsCheckbox.push(rs.goodsId)
|
|
|
})
|
|
|
- }else{
|
|
|
- this.goodsCheckbox = []
|
|
|
+ } else {
|
|
|
+ this.goodsCheckbox = []
|
|
|
}
|
|
|
+ },
|
|
|
+ // 管理按钮
|
|
|
+ handlerManage(){
|
|
|
+ this.manageShow = !this.manageShow
|
|
|
+ this.goodsCheckbox = []
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -238,4 +272,9 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .pop-box{
|
|
|
+ min-height: 400rpx;
|
|
|
+ padding: 20rpx;
|
|
|
+ }
|
|
|
</style>
|