yuanyuan 3 tahun lalu
induk
melakukan
fbf842462b
2 mengubah file dengan 122 tambahan dan 87 penghapusan
  1. 95 67
      src/views/user/ShoppingCart.vue
  2. 27 20
      src/views/user/ShoppingCartSubmit.vue

+ 95 - 67
src/views/user/ShoppingCart.vue

@@ -6,8 +6,8 @@
                     <img :src="require('@assets/icon-back@3x.png')" alt="" class="shopping_cart_top_one_img"
                         @click="$router.back()">
                     购物车
-                    <div class="shopping_cart_top_one_btn" v-if="active == 'ALL'">管理</div>
-                    <div class="shopping_cart_top_one_btns" v-else>完成</div>
+                    <div class="shopping_cart_top_one_btn" v-if="!showDelete" @click="showDelete = true">管理</div>
+                    <div class="shopping_cart_top_one_btns" v-else @click="showDelete = false">完成</div>
                 </div>
                 <div class="shopping_cart_top_two">
                     <div class="shopping_cart_top_two_con" :class="{ active: active === 'ALL' }"
@@ -20,63 +20,64 @@
                         售罄(2)
                         <div class="shopping_cart_top_two_con_two" v-if="active == 'SELLOUT'"></div>
                     </div>
-                    <div class="shopping_cart_top_two_con">
+                    <div class="shopping_cart_top_two_con" @click="cartExplain">
                         <img :src="require('@assets/icon-shuoming@3x.png')" alt="" class="shopping_cart_top_two_con_img">
                         <div>说明</div>
                     </div>
                 </div>
             </div>
         </van-sticky>
-        <!-- <van-pull-refresh v-if="collectionList.length == 0" success-text="加载成功" success-duration="500" class="search"
-            v-model="isLoading" :head-height="80" @refresh="onRefresh">
+        <van-pull-refresh success-text="加载成功" success-duration="500" class="search" v-model="isLoading" :head-height="80"
+            @refresh="onRefresh">
             <van-list style="padding-bottom: 100px" class="box-list" v-model:loading="loading" :finished="finished"
-                finished-text="">
-                <van-empty :image="require('@assets/empty_img_asset_dark.png')" v-if="empty" description="没有任何藏品哦~" />
-            </van-list>
-        </van-pull-refresh> -->
-        <div class="box-list">
-            <div class="box-list_con" v-for="(item, index) in collectionList" :key="index" @click="settle(index)">
-                <img :src="item.check ? select : unchecked" alt="" class="box-list_con_check">
-                <van-image width="80" height="80" :src="item.img" fit="contain" radius="8" />
-                <div v-if="item.type == 'DOMAIN'" class="box-list_con_right">
-                    <div class="box-list_con_right_top">
-                        <img :src="require('@assets/png-da-zi@3x.png')" alt="" class="box-list_con_right_top_img">
-                        <div class="box-list_con_right_top_title">
-                            <div class="box-list_con_right_top_title_name"
-                                :class="active == 'SELLOUT' ? 'box-list_con_right_top_title_names' : ''">{{ item.name }}
+                finished-text="" @load="getList">
+                <div class="box-list_con" v-for="(item, index) in collectionList" :key="index" @click="settle(index)">
+                    <img :src="item.check ? select : unchecked" alt="" class="box-list_con_check">
+                    <van-image width="80" height="80" :src="item.img" fit="contain" radius="8" />
+                    <div v-if="item.type == 'DOMAIN'" class="box-list_con_right">
+                        <div class="box-list_con_right_top">
+                            <img :src="require('@assets/png-da-zi@3x.png')" alt="" class="box-list_con_right_top_img">
+                            <div class="box-list_con_right_top_title">
+                                <div class="box-list_con_right_top_title_name"
+                                    :class="active == 'SELLOUT' ? 'box-list_con_right_top_title_names' : ''">{{ item.name }}
+                                </div>
+                                <div class="box-list_con_right_top_title_time">剩余时长&nbsp;{{ item.endTime }}</div>
                             </div>
-                            <div class="box-list_con_right_top_title_time">剩余时长&nbsp;{{ item.endTime }}</div>
                         </div>
+                        <div class="box-list_con_right_bottom" v-if="active == 'ALL'">
+                            <img :src="require('@assets/icon_jiage@3x (4).png')" alt=""
+                                class="box-list_con_right_bottom_price_img">
+                            <div class="box-list_con_right_bottom_price">{{ item.price }}</div>
+                        </div>
+                        <div class="box-list_con_right_bottom_noBuy" v-else>藏品已售罄不能购买</div>
                     </div>
-                    <div class="box-list_con_right_bottom" v-if="active == 'ALL'">
-                        <img :src="require('@assets/icon_jiage@3x (4).png')" alt=""
-                            class="box-list_con_right_bottom_price_img">
-                        <div class="box-list_con_right_bottom_price">{{ item.price }}</div>
-                    </div>
-                    <div class="box-list_con_right_bottom_noBuy" v-else>藏品已售罄不能购买</div>
-                </div>
-                <div v-else class="box-list_con_right_two">
-                    <div class="box-list_con_right_two_name"
-                        :class="active == 'SELLOUT' ? 'box-list_con_right_two_names' : ''">{{ item.name }}</div>
-                    <div class="box-list_con_right_two_information">
-                        <van-image width="14" height="14" :src="item.myImg" fit="cover" radius="100" />
-                        <div class="box-list_con_right_two_information_name">{{ item.myName }}</div>
-                    </div>
-                    <div class="box-list_con_right_bottom" v-if="active == 'ALL'">
-                        <img :src="require('@assets/icon_jiage@3x (4).png')" alt=""
-                            class="box-list_con_right_bottom_price_img">
-                        <div class="box-list_con_right_bottom_price">{{ item.price }}</div>
+                    <div v-else class="box-list_con_right_two">
+                        <div class="box-list_con_right_two_name"
+                            :class="active == 'SELLOUT' ? 'box-list_con_right_two_names' : ''">{{ item.name }}</div>
+                        <div class="box-list_con_right_two_information">
+                            <van-image width="14" height="14" :src="item.myImg" fit="cover" radius="100" />
+                            <div class="box-list_con_right_two_information_name">{{ item.myName }}</div>
+                        </div>
+                        <div class="box-list_con_right_bottom" v-if="active == 'ALL'">
+                            <img :src="require('@assets/icon_jiage@3x (4).png')" alt=""
+                                class="box-list_con_right_bottom_price_img">
+                            <div class="box-list_con_right_bottom_price">{{ item.price }}</div>
+                        </div>
+                        <div class="box-list_con_right_bottom_noBuy" v-else>藏品已售罄不能购买</div>
                     </div>
-                    <div class="box-list_con_right_bottom_noBuy" v-else>藏品已售罄不能购买</div>
                 </div>
-            </div>
-        </div>
-        <div class="shopping_cart_btn van-safe-area-bottom">
+                <van-empty :image="require('@assets/empty_img_asset_dark.png')" v-if="empty" description="没有任何藏品哦~" />
+            </van-list>
+        </van-pull-refresh>
+        <!-- <div class="box-list">
+
+        </div> -->
+        <div class="shopping_cart_btn van-safe-area-bottom" v-if="active == 'ALL' && showDelete == false">
             <div class="shopping_cart_btn_left" @click="checkAll">
                 <img :src="checkAllStatus ? select : unchecked" alt="" class="shopping_cart_btn_left_img">
                 <div>全选</div>
             </div>
-            <div class="shopping_cart_btn_right" v-if="active == 'ALL'">
+            <div class="shopping_cart_btn_right">
                 <div class="shopping_cart_btn_right_one">合计</div>
                 <div class="shopping_cart_btn_right_two">
                     <img :src="require('@assets/icon_jiage@3x (3).png')" alt="" class="shopping_cart_btn_right_two_img">
@@ -86,7 +87,13 @@
                     结算<span v-if="totalSettlement != 0">({{ totalSettlement }})</span>
                 </div>
             </div>
-            <div class="shopping_cart_btn_right" v-else>
+        </div>
+        <div class="shopping_cart_btn van-safe-area-bottom" v-else-if="showDelete == true">
+            <div class="shopping_cart_btn_left" @click="checkAll">
+                <img :src="checkAllStatus ? select : unchecked" alt="" class="shopping_cart_btn_left_img">
+                <div>全选</div>
+            </div>
+            <div class="shopping_cart_btn_right">
                 <div class="shopping_cart_btn_right_three" @click="del">
                     删除<span v-if="totalSettlement != 0">({{ totalSettlement }})</span>
                 </div>
@@ -105,34 +112,41 @@ export default {
             select: require('@assets/icon_gouxuan_pre@3x (2).png'),
             unchecked: require('@assets/icon_gouxuan_huise@3x (1).png'),
             collectionList: [
-                {
-                    type: 'DOMAIN',
-                    check: false,
-                    img: require('@assets/1091676369057_.pic@3x.png'),
-                    name: 'R.nft',
-                    endTime: '188天7时13分',
-                    price: 1000
-                },
-                {
-                    type: 'Collection',
-                    check: false,
-                    img: require('@assets/10561663573720_.pic_hd4@3x.png'),
-                    myImg: require('@assets/1091676369057_.pic@3x.png'),
-                    name: '游戏《百分之一》精美的礼物',
-                    myName: '持有者名称',
-                    endTime: '188天7时13分',
-                    price: 199
-                },
+                // {
+                //     type: 'DOMAIN',
+                //     check: false,
+                //     img: require('@assets/1091676369057_.pic@3x.png'),
+                //     name: 'R.nft',
+                //     endTime: '188天7时13分',
+                //     price: 1000
+                // },
+                // {
+                //     type: 'Collection',
+                //     check: false,
+                //     img: require('@assets/10561663573720_.pic_hd4@3x.png'),
+                //     myImg: require('@assets/1091676369057_.pic@3x.png'),
+                //     name: '游戏《百分之一》精美的礼物',
+                //     myName: '持有者名称',
+                //     endTime: '188天7时13分',
+                //     price: 199
+                // },
             ],
             price: 0,
             checkAllStatus: false,
             totalSettlement: 0,
-            page: 0
+            page: 0,
+            showDelete: false
         }
     },
+    mounted() {
+        // this.getList()
+    },
     methods: {
         changeActive(title) {
             this.active = title
+            this.showDelete = false
+        },
+        cartExplain() {
         },
         checkAll() {
             this.checkAllStatus = !this.checkAllStatus
@@ -143,6 +157,7 @@ export default {
                     item.check = true
                     this.price += Number(item.price)
                 })
+                this.price = this.price.toFixed(1)
             } else {
                 this.price = 0
                 this.totalSettlement = 0
@@ -162,9 +177,14 @@ export default {
             this.$nextTick(() => {
                 this.totalSettlement = newCollectionList.length
                 this.price = 0
-                for (let i = 0; i <= newCollectionList.length; i++) {
-                    this.price += Number(newCollectionList[i].price)
-                }
+                console.log("dcghcfgfc", newCollectionList)
+                newCollectionList.forEach(item => {
+                    this.price += Number(item.price)
+                })
+                this.price = this.price.toFixed(1)
+                // for (let i = 0; i <= newCollectionList.length; i++) {
+                //     this.price += Number(newCollectionList[i].price)
+                // }
             });
         },
         settleAccounts() {
@@ -233,6 +253,9 @@ export default {
                         this.collectionList = [];
                         this.page = 0;
                     }
+                    res.content.forEach(item => {
+                        item.check = false
+                    })
                     this.collectionList = [...this.collectionList, ...res.content];
                     this.empty = res.empty;
                     this.loading = false;
@@ -245,15 +268,19 @@ export default {
         onRefresh() {
             this.getList(true).then(() => {
                 this.isLoading = false;
+                this.price = 0
+                this.totalSettlement = 0
+                this.checkAllStatus = false
             });
         }
     }
 }
 </script>
 <style lang="less" scoped>
-/deep/ .van-dialog__header{
+/deep/ .van-dialog__header {
     padding-top: 24px !important;
 }
+
 .shopping_cart {
     background: #000000;
 
@@ -492,6 +519,7 @@ export default {
         box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.04);
         display: flex;
         justify-content: space-between;
+        z-index: 99;
 
         .shopping_cart_btn_left {
             display: flex;

+ 27 - 20
src/views/user/ShoppingCartSubmit.vue

@@ -59,6 +59,7 @@ export default {
             showKeyboard: false,
             showPwdDialog: false,
             id: '',
+            payName: '',
             collectionList: [
                 {
                     type: 'DOMAIN',
@@ -188,26 +189,32 @@ export default {
             if (this.payType == 'BALANCE') {
                 this.showPwdDialog = true;
             }
-            this.createOrder()
-                .then(res => {
-                    this.id = res.id;
-                    if (this.payType != 'BALANCE') {
-                        this.pay();
-                    }
-                }).catch(e => {
-                    if (e) {
-                        this.showPwdDialog = false;
-                        this.$toast.clear();
-                        this.$dialog
-                            .alert({
-                                title: '提示',
-                                message: this.backReson(e.error)
-                            })
-                            .then(res => {
-                                this.$router.back();
-                            });
-                    }
-                });
+            if (this.payName == '1') {
+                if (this.payType != 'BALANCE') {
+                    this.pay();
+                }
+            } else {
+                this.createOrder()
+                    .then(res => {
+                        this.id = res.id;
+                        if (this.payType != 'BALANCE') {
+                            this.pay();
+                        }
+                    }).catch(e => {
+                        if (e) {
+                            this.showPwdDialog = false;
+                            this.$toast.clear();
+                            this.$dialog
+                                .alert({
+                                    title: '提示',
+                                    message: this.backReson(e.error)
+                                })
+                                .then(res => {
+                                    this.$router.back();
+                                });
+                        }
+                    });
+            }
         },
         pay() {
             if (this.payType == 'BALANCE') {