Browse Source

购物车 对接 删除 数量修改 提交订单

zxl 1 year ago
parent
commit
e0b46a82aa

+ 4 - 1
README.md

@@ -26,4 +26,7 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
 http://apidoc.chelvc.com/admin/
 http://apidoc.chelvc.com/maintain/
 
-wangzhongqing 564342
+wangzhongqing 564342
+
+http://gogs.chelvc.com/  git
+https://js.design/ti?c=fMpU7uE9B48CA8a/ // ui图

File diff suppressed because it is too large
+ 19483 - 2
package-lock.json


+ 49 - 0
src/api/client/business.js

@@ -137,3 +137,52 @@ export function getShoppingCart(data) {
   });
 }
 
+
+/**
+ * 购物车接口 - 删除购物车
+ * @param {*} data
+ * @returns
+ */
+export function deleteCartItem(data) {
+  return request({
+    url: `/maintain/cartItem/deleteCartItem`,
+    method: 'post',
+    data: data,
+    header: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+  });
+}
+
+/**
+ * 购物车接口 - 修改购物车商品的数量
+ * @param {*} data
+ * @returns
+ */
+export function editGoodsNumb(id,data) {
+  return request({
+    url: `/maintain/cartItem/${id}`,
+    method: 'get',
+    data: data,
+    header: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+  });
+}
+
+/**
+ * 购物车接口 - 修改购物车商品的数量
+ * @param {*} data
+ * @returns
+ */
+export function generateConfirmOrder(data) {
+  return request({
+    url: `/maintain/generateConfirmOrder`,
+    method: 'post',
+    data: data,
+    header: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+  });
+}
+

+ 1 - 0
src/components/merchant/RecommendItem.vue

@@ -42,6 +42,7 @@ export default {
       image {
         width: calc(50vw - 30rpx);
         height: 240rpx;
+        border-radius: 10rpx;
       }
       .name {
         width: 100%;

+ 1 - 0
src/pages/client/clientPackage/storeDetail.vue

@@ -426,6 +426,7 @@
       height: 100%;
       display: block;
       margin-right: 10rpx;
+      border-radius: 10rpx;
     }
 
     .listDetail {

+ 6 - 8
src/pages/client/clientPackage/uptickOrder.vue

@@ -108,8 +108,6 @@
 		onLoad(option) {
 			this.id = option.id;
 			this.order_list = this.$store.state.order.order_list
-			console.log('@@@order_list',this.order_list);
-			// this.orderDetailGood();
 		},
 		computed: {
 			// 商品小计
@@ -127,7 +125,7 @@
 				return (this.shopAccount - this.totalAccount).toFixed(2);
 			},
 		},
-		
+
 		methods: {
 			// 加减数量
 			handlerChangeOrderNumber(e){
@@ -135,13 +133,13 @@
 					case 0 :
 						++ this.order_number
 					break;
-					case 1 : 
+					case 1 :
 						if(this.order_number == 0){
 							uni.showToast({
 								title:'不能再减了',
 								icon:'none'
 							})
-							return 
+							return
 						}else{
 							--this.order_number
 						}
@@ -156,8 +154,8 @@
 					console.log('@@@@res',res);
 				})
 			},
-			
-			
+
+
 		},
 	};
 </script>
@@ -351,4 +349,4 @@
 			border-radius: 40rpx;
 		}
 	}
-</style>
+</style>

+ 67 - 28
src/pages/client/clientUser/cart/index.vue

@@ -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>

+ 1 - 0
src/pages/client/clientUser/mine/setting.vue

@@ -127,6 +127,7 @@ export default {
 }
 
 .exit {
+  display: flex;
   width: 100%;
 }
 .button {

Some files were not shown because too many files changed in this diff