x1ongzhu 6 سال پیش
والد
کامیت
83a7eeeab0

+ 3 - 11
src/components/CoinModal.vue

@@ -1,7 +1,7 @@
 <template>
     <cover-view class="coin-modal" v-if="visible" @click="dismiss">
         <cover-view class="mask" :class="{show:show}"></cover-view>
-        <cover-view class="body" :class="{show:show,close:close}">
+        <cover-view class="body" :class="{show:show}">
             <cover-image class="bg" src="/static/images/img_coin_modal.png">
             </cover-image>
             <cover-view class="title">{{title}}</cover-view>
@@ -29,7 +29,6 @@ export default {
         return {
             show: false,
             dismissing: false,
-            close: false,
         };
     },
     methods: {
@@ -37,12 +36,10 @@ export default {
             if (this.dismissing) return;
             this.dismissing = true;
             this.show = false;
-            this.close = true;
             setTimeout(() => {
                 this.$emit('update:visible', false);
                 this.$emit('dismiss');
                 this.dismissing = false;
-                this.close = false;
             }, 300);
         },
     },
@@ -72,7 +69,7 @@ export default {
         right: 0;
         bottom: 0;
         left: 0;
-        transition: all 0.3s;
+        transition: all 0.2s;
         opacity: 0;
         &.show {
             opacity: 1;
@@ -87,16 +84,11 @@ export default {
         width: 335px;
         height: 292px;
         margin: auto;
-        transition: all 0.3s ease;
-        transform: translateY(200px);
+        transition: all 0.2s;
         opacity: 0;
         &.show {
-            transform: translateY(0);
             opacity: 1;
         }
-        &.close {
-            transform: translateY(0);
-        }
         .bg {
             width: 100%;
             height: 100%;

+ 2 - 7
src/components/Tabs.vue

@@ -1,12 +1,7 @@
 <template>
     <div class="tabs">
-        <div
-            class="tab"
-            v-for="(item, i) in tabs"
-            :key="item"
-            :class="{active:value===i}"
-            @click="tabClick(i)"
-        >{{item}}</div>
+        <div class="tab" v-for="(item, i) in tabs" :key="item"
+            :class="{active:value===i}" @click="tabClick(i)">{{item}}</div>
     </div>
 </template>
 

+ 2 - 2
src/pages/home/home.vue

@@ -18,8 +18,7 @@
                 :longitude="center.longitude" :latitude="center.latitude"
                 scale="15" :polyline="polyline" :markers="markers"
                 @regionchange="regionChange" @begin="regionChangeBegin"
-                @end="regionChangeEnd" @updated="updated"
-                @markertap="markerTap">
+                @end="regionChangeEnd" @updated="updated" @markertap="markerTap">
                 <cover-view class="header" v-if="!showTopContainer"
                     :style="{paddingTop: sysInfo.statusBarHeight+'px'}">
                     <cover-image class="bg" src="/static/images/bg_nav.png">
@@ -201,6 +200,7 @@ export default {
                 //     });
                 // }
                 // sequence.then(() => {});
+                this.showTopContainer = true;
                 if (res.data.todaySteps + res.data.teamSteps != this.todaySteps + this.teamSteps) {
                     this.showTopContainer = true;
                 }

+ 37 - 0
src/pages/myTeam/myTeam.vue

@@ -40,6 +40,10 @@
                 :price="myLeader.price">
             </team-member>
         </div>
+        <div class="empty" v-if="showEmpty">
+            <img src="/static/images/img_empty_team.png" class="img">
+            <div class="tip">{{tip}}</div>
+        </div>
 
         <button class="btn-recruit" @click="recruit">招募新队员</button>
         <alert-dialog type="float" :visible.sync="showDialog"
@@ -110,6 +114,26 @@ export default {
                 height: 535 / 335 * (this.sysInfo.windowWidth - 108) + 'px',
             };
         },
+        tip() {
+            switch (this.tab) {
+                case 0:
+                    return '你暂时还没有好友哦~';
+                case 1:
+                    return '你暂时还没有队员哦~';
+                case 2:
+                    return '你暂时还没有队长哦~';
+            }
+        },
+        showEmpty() {
+            switch (this.tab) {
+                case 0:
+                    return this.friends.length === 0;
+                case 1:
+                    return this.teamMembers.length === 0;
+                case 2:
+                    return !!this.fmyLeader;
+            }
+        },
     },
     onShow() {
         wx.showShareMenu({});
@@ -380,6 +404,19 @@ export default {
             background: @primaryColor;
         }
     }
+    .empty {
+        margin-top: 62px;
+        text-align: center;
+        .img {
+            width: 121px;
+            height: 113px;
+        }
+        .tip {
+            font-size: 13px;
+            color: @disableColor;
+            margin-top: 24px;
+        }
+    }
     .btn-recruit {
         .primaryButton(44px);
         position: fixed;

+ 444 - 0
src/pages/orders/orderItem copy.vue

@@ -0,0 +1,444 @@
+<template>
+    <div class="order-item" @click="viewOrder">
+        <div class="id">
+            <div class="id-no">订单号:{{order.id}}</div>
+            <div class="status" :style="{color:status.color}">{{status.name}}
+            </div>
+        </div>
+        <div class="divider"></div>
+        <div class="content">
+            <img class="cover" mode="aspectFill"
+                :src="order.product?order.product.banner[0]:''" />
+            <div class="info">
+                <div class="name">{{order.product?order.product.name:''}}</div>
+                <div class="spec">{{order.product?order.productSpec.name:''}}
+                </div>
+                <div class="price">
+                    <price-tag :money="price" :coin="coin" :size="[11,14]"
+                        color="#000000" long></price-tag>
+                    <span class="amount">×{{order.amount}}</span>
+                </div>
+            </div>
+        </div>
+        <div class="real-pay-wrapper" v-if="showRealPay">
+            <div class="real-pay">
+                <span class="label">实际支付:</span>
+                <price-tag :money="order.money" :coin="order.coin"
+                    :size="[11,14]" color="#FF7700"></price-tag>
+            </div>
+        </div>
+        <div style="height:10px" v-if="!showRealPay"></div>
+        <div class="divider" v-if="btns.length"></div>
+        <div class="btns" v-if="btns.length">
+            <button v-for="item in btns" :class="['btn', item.class]"
+                :key="item.title" @click.stop.prevent="btnClick(item.title)">
+                {{item.title}}
+            </button>
+        </div>
+    </div>
+</template>
+
+<script>
+import Constants from '../../Constants';
+import PriceTag from '@/components/PriceTag';
+export default {
+    props: {
+        order: {},
+    },
+    data() {
+        return {
+            status: {
+                name: '',
+            },
+            price: 0,
+            coin: 0,
+            btns: [],
+        };
+    },
+    created() {
+        console.log('created');
+        let status = {
+            name: '',
+        };
+        let btns = [];
+        switch (this.order.status) {
+            case Constants.OrderStatus.NOT_PAID:
+                status.name = '待支付';
+                btns = [
+                    {
+                        class: 'sec',
+                        title: '取消订单',
+                    },
+                    {
+                        class: 'prim',
+                        title: '立即支付',
+                    },
+                ];
+                break;
+            case Constants.OrderStatus.PAID:
+                status.name = '已支付';
+                btns = [
+                    {
+                        class: 'border',
+                        title: '查看订单',
+                    },
+                ];
+                break;
+            case Constants.OrderStatus.DELIVERING:
+                status.name = '待收货';
+                btns = [
+                    {
+                        class: 'border',
+                        title: '查看物流',
+                    },
+                    {
+                        class: 'prim',
+                        title: '确认收货',
+                    },
+                ];
+                break;
+            case Constants.OrderStatus.NOT_RATED:
+                status.name = '待评价';
+                btns = [
+                    {
+                        class: 'border',
+                        title: '再次购买',
+                    },
+                    {
+                        class: 'prim',
+                        title: '评价',
+                    },
+                ];
+                break;
+            case Constants.OrderStatus.RATED:
+                status.name = '交易成功';
+                btns = [
+                    {
+                        class: 'border',
+                        title: '再次购买',
+                    },
+                ];
+                break;
+            case Constants.OrderStatus.CANCELED:
+                status.name = '已取消';
+                status.color = '#989898';
+                btns = [
+                    {
+                        class: 'sec',
+                        title: '删除订单',
+                    },
+                ];
+                break;
+        }
+        this.status = status;
+        this.btns = btns;
+        if (this.order.payMode == Constants.PayMode.DISCOUNT) {
+            this.price = this.order.productSpec.discountPrice;
+        } else if (this.order.payMode == Constants.PayMode.ORIGINAL) {
+            this.price = this.order.productSpec.originalPrice;
+        }
+        if (this.order.payMode !== Constants.PayMode.DISCOUNT) {
+            this.coin = this.order.productSpec.coin;
+        } else {
+            this.coin = 0;
+        }
+    },
+    computed: {
+        showRealPay() {
+            return this.order.status !== Constants.OrderStatus.CANCELED && this.order.status !== Constants.OrderStatus.NOT_PAID;
+        },
+    },
+    methods: {
+        btnClick(title) {
+            console.log(title);
+            switch (title) {
+                case '立即支付':
+                    this.payOrder();
+                    break;
+                case '取消订单':
+                    this.cancelOrder();
+                    break;
+                case '查看订单':
+                    this.viewOrder();
+                    break;
+                case '删除订单':
+                    this.deleteOrder();
+                    break;
+                case '再次购买':
+                    this.buyMore();
+                    break;
+                case '确认收货':
+                    this.confirmReceipt();
+                    break;
+                case '评价':
+                    this.comment();
+                    break;
+            }
+        },
+        viewOrder() {
+            wx.navigateTo({
+                url: `/pages/orderDetail/orderDetail?id=${this.order.id}`,
+            });
+        },
+        async cancelOrder() {
+            let { confirm } = await this.$wx.showModal({
+                content: '确认取消?',
+            });
+            if (!confirm) return;
+            wx.showLoading({
+                title: '取消订单',
+                mask: true,
+            });
+            this.$http
+                .post('/order/cancel', { id: this.order.id })
+                .then(res => {
+                    wx.hideLoading();
+                    if (!res.success) {
+                        wx.shoToast({
+                            title: res.error,
+                            icon: 'none',
+                        });
+                    }
+                    this.$emit('refresh');
+                })
+                .catch(e => {
+                    wx.hideLoading();
+                    console.log(e);
+                });
+        },
+        payOrder() {
+            wx.showLoading({
+                title: '提交订单',
+                mask: true,
+            });
+            this.$http
+                .post('/order/pay', {
+                    id: this.order.id,
+                })
+                .then(res => {
+                    wx.hideLoading();
+                    console.log(res);
+                    if (res.success) {
+                        res.data.package = res.data.packageValue;
+                        this.$wx
+                            .requestPayment(res.data)
+                            .then(res => {
+                                console.log(res);
+                                this.$emit('refresh');
+                            })
+                            .catch(e => {
+                                console.log(e);
+                                this.$emit('refresh');
+                            });
+                    } else {
+                    }
+                })
+                .catch(e => {
+                    wx.hideLoading();
+                    console.log(e);
+                });
+        },
+        async deleteOrder() {
+            let { confirm } = await this.$wx.showModal({
+                content: '确认删除?',
+            });
+            if (!confirm) return;
+            wx.showLoading({
+                title: '删除订单',
+                mask: true,
+            });
+            this.$http
+                .post('/order/del', {
+                    id: this.order.id,
+                })
+                .then(res => {
+                    wx.hideLoading();
+                    if (res.success) {
+                        this.$emit('refresh');
+                    } else {
+                        wx.showToast({
+                            title: res.error,
+                            icon: 'none',
+                        });
+                    }
+                })
+                .catch(e => {
+                    wx.hideLoading();
+                    console.log(e);
+                });
+        },
+        buyMore() {
+            wx.navigateTo({
+                url: `/pages/productDetail/productDetail?id=${this.order.productId}`,
+            });
+        },
+        confirmReceipt() {
+            this.$wx
+                .showModal({
+                    title: '提示',
+                    content: '是否确认收货?',
+                })
+                .then(res => {
+                    if (res.confirm) {
+                        wx.showLoading({
+                            title: '确认收货',
+                            mask: true,
+                        });
+                        this.$http
+                            .post('/order/confirmReceipt', {
+                                id: this.order.id,
+                            })
+                            .then(res => {
+                                wx.hideLoading();
+                                if (res.success) {
+                                    this.$emit('refresh');
+                                } else {
+                                    wx.showToast({
+                                        title: res.error,
+                                        icon: 'none',
+                                    });
+                                }
+                            })
+                            .catch(e => {
+                                wx.hideLoading();
+                                console.log(e);
+                            });
+                    }
+                });
+        },
+        comment() {
+            wx.navigateTo({
+                url: `/pages/productComment/productComment?orderId=${this.order.id}&productId=${this.order.productId}&pic=${this.order.product.banner[0]}`,
+            });
+        },
+    },
+    watch: {
+        order() {
+            console.log('updated');
+        },
+    },
+    components: {
+        PriceTag,
+    },
+};
+</script>
+
+<style lang="less" scoped>
+.order-item {
+    margin: 0 15px 10px 15px;
+    padding: 0 15px;
+    background: white;
+    border-radius: 6px;
+    .id {
+        height: 43px;
+        .flex();
+        .id-no {
+            flex-grow: 1;
+            font-size: 13px;
+            color: @textColorPrimaryDark;
+        }
+        .status {
+            font-size: 13px;
+            font-weight: bold;
+            color: @primaryColor;
+        }
+    }
+    .divider {
+        width: 100%;
+        height: 1px;
+        background: @bgColor;
+    }
+    .content {
+        .flex();
+        width: 100%;
+        height: 80px;
+        align-items: flex-start;
+        margin-top: 15px;
+        .cover {
+            width: 80px;
+            height: 80px;
+            min-width: 80px;
+            border-radius: 4px;
+        }
+        .info {
+            height: 80px;
+            .flex-col();
+            align-items: flex-start;
+            justify-content: space-between;
+            flex-grow: 1;
+            margin-left: 10px;
+            .name {
+                font-size: 14px;
+                color: @textColorPrimaryDark;
+                word-break: break-all;
+                .ellipsisLn(2);
+            }
+            .spec {
+                color: @disableColor;
+                font-size: 12px;
+            }
+            .price {
+                .flex();
+                width: 100%;
+                align-items: baseline;
+                font-size: 11px;
+                color: @textColorPrimaryDark;
+                font-weight: bold;
+                .amount {
+                    color: @disableColor;
+                    font-size: 14px;
+                    font-weight: normal;
+                    flex-grow: 1;
+                    text-align: right;
+                }
+            }
+        }
+    }
+    .real-pay-wrapper {
+        .flex();
+        height: 40px;
+        width: 100%;
+        justify-content: flex-end;
+        .real-pay {
+            .flex();
+            align-items: baseline;
+            font-size: 11px;
+            color: @highlightColor;
+            justify-content: flex-end;
+            .label {
+                color: #666666;
+                font-size: 12px;
+                font-weight: normal;
+            }
+        }
+    }
+    .btns {
+        height: 58px;
+        width: 100%;
+        .flex();
+        justify-content: flex-end;
+        .btn {
+            height: 28px;
+            width: 76px;
+            .flex();
+            justify-content: center;
+            border-radius: 14px;
+            font-size: 12px;
+            box-sizing: border-box;
+            margin-left: 10px;
+            &.prim {
+                background: linear-gradient(90deg, rgba(42, 123, 255, 1) 0%, rgba(122, 70, 255, 1) 100%);
+                color: white;
+            }
+            &.border {
+                border: 1px solid @primaryColor;
+                color: @primaryColor;
+            }
+            &.sec {
+                border: 1px solid @disableColor;
+                color: @disableColor;
+            }
+        }
+    }
+}
+</style>

+ 33 - 3
src/pages/orders/orders.vue

@@ -1,6 +1,10 @@
 <template>
     <div class="container">
         <tabs :tabs="['全部','待付款','待收货','已完成']" v-model="tab"></tabs>
+        <div class="empty" v-if="empty">
+            <img class="img" src="/static/images/img_empty.png">
+            <div class="tip">这里空空如也~</div>
+        </div>
         <div class="list">
             <order-item v-for="item in orders" :key="item.id" :order="item"
                 @refresh="refresh">
@@ -13,6 +17,7 @@
 import OrderItem from './orderItem';
 import Tabs from '@/components/Tabs';
 import Constants from '@/Constants';
+let identity = 0;
 export default {
     onLoad() {
         this.getData();
@@ -27,6 +32,7 @@ export default {
             tab: 0,
             page: 0,
             last: false,
+            empty: false,
         };
     },
     computed: {
@@ -67,14 +73,25 @@ export default {
                     }
                 )
                 .then(res => {
-                    console.log(res);
                     wx.stopPullDownRefresh();
                     if (res.success) {
                         this.last = res.data.last;
+                        res.data.content.forEach(i => {
+                            i.key = 'order' + identity;
+                            identity++;
+                        });
+                        let orders;
                         if (res.data.first) {
-                            this.orders = [];
+                            orders = [];
+                        } else {
+                            orders = [...this.orders];
                         }
-                        this.orders = this.orders.concat(res.data.content);
+                        orders = orders.concat(res.data.content);
+                        this.orders = [];
+                        wx.nextTick(() => {
+                            this.orders = [...orders];
+                            this.empty = this.orders.length === 0;
+                        });
                     }
                 })
                 .catch(e => {
@@ -114,5 +131,18 @@ export default {
         -webkit-overflow-scrolling: touch;
         padding-top: 5px;
     }
+    .empty {
+        margin-top: 60px;
+        text-align: center;
+        .img {
+            width: 110px;
+            height: 110px;
+        }
+        .tip {
+            margin-top: 24px;
+            font-size: 13px;
+            color: @disableColor;
+        }
+    }
 }
 </style>

+ 2 - 2
src/utils/http.js

@@ -1,5 +1,5 @@
-// const baseUrl = 'http://192.168.50.132:8080';
-const baseUrl = 'https://walkchina.yzkm001.cn';
+const baseUrl = 'http://192.168.50.132:8080';
+// const baseUrl = 'https://walkchina.yzkm001.cn';
 function parseUrl(url) {
     let _baseUrl = baseUrl;
     if (url.startsWith('http')) {

BIN
static/images/img_empty_team.png