|
@@ -6,27 +6,32 @@
|
|
|
</view>
|
|
|
<!-- 列表1 -->
|
|
|
<!-- <CartList :init_list.sync='init_list' :isAllSecect.sync='isAllSecect' @handlerIsSelectAll='handlerIsSelectAll'></CartList> -->
|
|
|
- <view class="item-box">
|
|
|
+ <view>
|
|
|
<u-checkbox-group shape='circle' placement="column" v-model="goodsCheckbox">
|
|
|
- <shopCarItem />
|
|
|
- <!-- <view class="item" v-for="(item,index) of init_list" :key='index'>
|
|
|
- <view class="item-l">
|
|
|
- <view class="l-l">
|
|
|
- <u-checkbox :name='item.goodsId'></u-checkbox>
|
|
|
- </view>
|
|
|
- <view class="l-r">
|
|
|
- <image class="r-img" src="@/static/QR57a.jpg" mode="aspectFill"></image>
|
|
|
- <view class="r-box">
|
|
|
- <view class="r-name">{{ item.goodsName }}</view>
|
|
|
- <view class="r-discript">{{ item.goodsSubTitle }}</view>
|
|
|
- <view class="r-price">¥{{ (item.price * item.quantity).toFixed(2) }}</view>
|
|
|
+ <view class="item-box" v-for="item of init_list">
|
|
|
+ <view class="item-top" @click="handlerSkipShopDetail(item)">
|
|
|
+ <view class="top-title"> {{ item.name }} </view>
|
|
|
+ <u-icon name="arrow-right"></u-icon>
|
|
|
+ </view>
|
|
|
+ <view class="item" v-for="(itm,idx) of item.cartItems" :key='idx' @click="handlerSkipGoodsDetail(item,idx)">
|
|
|
+ <view class="item-l">
|
|
|
+ <view class="l-l">
|
|
|
+ <u-checkbox :name='itm.id'></u-checkbox>
|
|
|
+ </view>
|
|
|
+ <view class="l-r">
|
|
|
+ <image class="r-img" src="@/static/QR57a.jpg" mode="aspectFill"></image>
|
|
|
+ <view class="r-box">
|
|
|
+ <view class="r-name">{{ itm.goodsName }}</view>
|
|
|
+ <view class="r-discript">{{ itm.goodsName }}</view>
|
|
|
+ <view class="r-price">¥{{ (itm.price * itm.quantity).toFixed(2) }}</view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="item-r">
|
|
|
+ <u-number-box v-model="itm.quantity" @change="valChange(itm,$event)"></u-number-box>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <view class="item-r">
|
|
|
- <u-number-box v-model="item.quantity" @change="valChange(item,$event)"></u-number-box>
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
</u-checkbox-group>
|
|
|
</view>
|
|
|
|
|
@@ -54,7 +59,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="settleAccount" @click="handlerSettleBill">
|
|
|
- {{ !manageShow ? `结算( ${allPrice.goodsNumber} )` : `删除( ${allPrice.goodsNumber} ) ` }} </view>
|
|
|
+ {{ !manageShow ? `结算( ${allPrice.goodsNumber} )` : `删除( ${allPrice.goodsNumber} ) ` }}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
<u-popup :show="instructionShow" mode='bottom' @close="instructionShow = false" round='20'>
|
|
@@ -72,9 +78,7 @@
|
|
|
editGoodsNumb,
|
|
|
generateConfirmOrder
|
|
|
} from "@/api/client/business.js"
|
|
|
- import shopCarItem from "@/components/shopCarItem/shopCarItem"
|
|
|
export default {
|
|
|
- components:{shopCarItem},
|
|
|
data() {
|
|
|
return {
|
|
|
init_list: [],
|
|
@@ -84,9 +88,10 @@
|
|
|
instructionShow: false, // 底部优惠明细
|
|
|
|
|
|
manageShow: false,
|
|
|
- queryParams:{
|
|
|
- paging:'1,10'
|
|
|
- }
|
|
|
+ queryParams: {
|
|
|
+ paging: '1,10'
|
|
|
+ },
|
|
|
+ AllGoods: []
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
@@ -94,7 +99,7 @@
|
|
|
},
|
|
|
watch: {
|
|
|
goodsCheckbox(newValue) {
|
|
|
- if (newValue.length == this.init_list.length) {
|
|
|
+ if (newValue.length == this.AllGoods.length && (newValue.length != 0 || this.AllGoods.length != 0)) {
|
|
|
this.isAllSecect.push("0")
|
|
|
} else {
|
|
|
this.isAllSecect = []
|
|
@@ -106,8 +111,8 @@
|
|
|
let sum = 0
|
|
|
let goodsNumber = 0
|
|
|
this.goodsCheckbox.map(rs => {
|
|
|
- this.init_list.map(rc => {
|
|
|
- if (rs == rc.goodsId) {
|
|
|
+ this.AllGoods.map(rc => {
|
|
|
+ if (rs == rc.id) {
|
|
|
rc.allPrice = Number((rc.price * rc.quantity).toFixed(2))
|
|
|
sum += rc.allPrice
|
|
|
goodsNumber += rc.quantity
|
|
@@ -124,23 +129,40 @@
|
|
|
// 初始化购物车列表
|
|
|
handlerInitList() {
|
|
|
getShoppingCart(this.queryParams).then(res => {
|
|
|
- this.init_list = res.data
|
|
|
+ this.init_list = res.data.records
|
|
|
+ this.init_list.map(rs => {
|
|
|
+ rs.cartItems.map(rc => {
|
|
|
+ this.AllGoods.push(rc)
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
// 结算按钮
|
|
|
handlerSettleBill() {
|
|
|
if (this.manageShow) {
|
|
|
- deleteCartItem({
|
|
|
- ids: this.goodsCheckbox
|
|
|
- }).then(res => {
|
|
|
- console.log('@@@@res', res)
|
|
|
+ deleteCartItem( this.goodsCheckbox.join(',')).then(res => {
|
|
|
+ if(res.code == 200){
|
|
|
+ uni.showToast({
|
|
|
+ title:'删除成功',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ this.handlerInitList()
|
|
|
+ this.AllGoods = []
|
|
|
+ this.isAllSecect = []
|
|
|
+ this.goodsCheckbox = []
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ title:res.msg,
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
})
|
|
|
} else {
|
|
|
generateConfirmOrder({
|
|
|
cartIds: this.goodsCheckbox,
|
|
|
payType: 2
|
|
|
}).then(res => {
|
|
|
- console.log('@@@@res', res)
|
|
|
if (res.code == 200) {
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/client/clientPackage/uptickOrder'
|
|
@@ -149,9 +171,9 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ // 修改商品数量
|
|
|
valChange(item, e) {
|
|
|
- editGoodsNumb(item.goodsId, {
|
|
|
+ editGoodsNumb(item.id, {
|
|
|
quantity: e.value
|
|
|
}).then(res => {
|
|
|
console.log('@@@2res', res)
|
|
@@ -162,8 +184,8 @@
|
|
|
isAllChange(e) {
|
|
|
if (e.length) {
|
|
|
this.goodsCheckbox = []
|
|
|
- this.init_list.map(rs => {
|
|
|
- this.goodsCheckbox.push(rs.goodsId)
|
|
|
+ this.AllGoods.map(rs => {
|
|
|
+ this.goodsCheckbox.push(rs.id)
|
|
|
})
|
|
|
} else {
|
|
|
this.goodsCheckbox = []
|
|
@@ -173,6 +195,18 @@
|
|
|
handlerManage() {
|
|
|
this.manageShow = !this.manageShow
|
|
|
this.goodsCheckbox = []
|
|
|
+ },
|
|
|
+ // 跳转到商家详情
|
|
|
+ handlerSkipShopDetail(item){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/client/clientPackage/storeDetail?id=${item.id}`,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 跳转到商品详情
|
|
|
+ handlerSkipGoodsDetail(item,idx){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/client/clientPackage/serviceDetail/index?id=${item.cartItems[idx].goodsId}&shopId=${item.id}`,
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -225,65 +259,80 @@
|
|
|
}
|
|
|
|
|
|
.item-box {
|
|
|
+ background-color: #FFFFFF;
|
|
|
+ padding: 4rpx 20rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ margin-bottom: 20rpx;
|
|
|
|
|
|
- .item {
|
|
|
+ .item-top {
|
|
|
+ padding: 20rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
- background-color: #FFFFFF;
|
|
|
- padding: 4rpx 20rpx;
|
|
|
- border-radius: 10rpx;
|
|
|
- margin-bottom: 20rpx;
|
|
|
|
|
|
- .item-l {
|
|
|
- width: 70%;
|
|
|
+ .top-title {
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 32rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ .item {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 20rpx;
|
|
|
+
|
|
|
+ .item-l {
|
|
|
+ width: 70%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .l-r {
|
|
|
display: flex;
|
|
|
- align-items: center;
|
|
|
|
|
|
- .l-r {
|
|
|
+ .r-img {
|
|
|
+ width: 200rpx;
|
|
|
+ height: 200rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .r-box {
|
|
|
display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-around;
|
|
|
+ width: 50%;
|
|
|
|
|
|
- .r-img {
|
|
|
- width: 200rpx;
|
|
|
- height: 200rpx;
|
|
|
- border-radius: 10rpx;
|
|
|
+ .r-name {
|
|
|
+ font-size: 34rpx;
|
|
|
+ font-weight: bold;
|
|
|
}
|
|
|
|
|
|
- .r-box {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- justify-content: space-around;
|
|
|
- width: 50%;
|
|
|
-
|
|
|
- .r-name {
|
|
|
- font-size: 34rpx;
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
-
|
|
|
- .r-discript {
|
|
|
- max-width: 200rpx;
|
|
|
- background-color: #F7F8FA;
|
|
|
- padding: 5rpx 10rpx;
|
|
|
- border-radius: 10rpx;
|
|
|
- display: -webkit-box;
|
|
|
- -webkit-line-clamp: 2;
|
|
|
- -webkit-box-orient: vertical;
|
|
|
- overflow: hidden;
|
|
|
- text-overflow: ellipsis;
|
|
|
- }
|
|
|
+ .r-discript {
|
|
|
+ max-width: 200rpx;
|
|
|
+ background-color: #F7F8FA;
|
|
|
+ padding: 5rpx 10rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
|
|
|
- .r-price {
|
|
|
- color: #FF4D60;
|
|
|
- font-weight: bold;
|
|
|
- font-size: 28rpx;
|
|
|
- }
|
|
|
+ .r-price {
|
|
|
+ color: #FF4D60;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 28rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- .item-r {
|
|
|
- width: 30%;
|
|
|
- }
|
|
|
+ .item-r {
|
|
|
+ width: 30%;
|
|
|
}
|
|
|
}
|
|
|
|