喻文俊 3 роки тому
батько
коміт
91c28295ea

+ 42 - 1
common/util.js

@@ -87,9 +87,50 @@ export const makeQueryStr = (obj) => {
     return strs.join('&')
 }
 
+/**
+ * 倒计时
+ * @param diff 倒计时时间/s
+ * @param loadTime 运行时的当前时间
+ * @param item 倒计时对象
+ * @param callback 回调
+ */
+const countDown = function(diff, loadTime, item, callback) {
+    function round($diff) {
+        let dd = parseInt($diff / 1000 / 60 / 60 / 24, 10) // 计算剩余的天数
+        let hh = parseInt(($diff / 1000 / 60 / 60) % 24, 10) // 计算剩余的小时数
+        let mm = parseInt(($diff / 1000 / 60) % 60, 10) // 计算剩余的分钟数
+        let ss = parseInt(($diff / 1000) % 60, 10) // 计算剩余的秒数
+
+        function checkTime(_a) {
+            let a = _a
+            if (a < 10) {
+                a = '0' + a
+            }
+            return a.toString()
+        }
+
+        item.conttainer = {
+            dd: checkTime(dd),
+            hh: checkTime(hh),
+            mm: checkTime(mm),
+            ss: checkTime(ss),
+        }
+
+        if (item.conttainer.dd > 0 || item.conttainer.hh > 0 || item.conttainer.mm > 0 || item.conttainer.ss > 0) {
+            item.t = setTimeout(() => {
+                callback && callback(item)
+                round($diff - 1000)
+            }, 1000)
+        } else {
+            callback && callback(item)
+        }
+    }
+    round(diff - loadTime)
+}
+
 const install = (Vue, vm) => {
     console.log('初始化挂载($util)工具方法 util.js ')
-    Vue.prototype.$util = { msg, prePage, modal, makeQueryStr }
+    Vue.prototype.$util = { msg, prePage, modal, makeQueryStr, countDown }
 }
 
 export default install

+ 25 - 10
components/cm-module/cm-order-control-nav/cm-order-control-nav.vue

@@ -1,7 +1,17 @@
 <template>
     <view class="cm-order-control-nav">
-        <view class="btn type2" v-if="btnState.share" @click.stop="handleClick('fightDetail')">拼团详情</view>
-        <view class="btn type1" v-if="btnState.share" @click.stop="handleClick('share')">邀好友拼团</view>
+        <view class="btn type2" v-if="btnState.fightDetail" @click.stop="handleClick('fightDetail')">拼团详情</view>
+       <!-- <button
+            class="btn type1"
+            id="fightShare"
+            v-if="btnState.fightShare"
+            @click.stop="handleClick('fightShare')"
+            open-type="share"
+            :data-share="orderInfo"
+        >
+            邀好友拼团
+        </button> -->
+        <view class="btn type1" v-if="btnState.fightShare" @click.stop="handleClick('fightShare')">邀好友拼团</view>
         <view class="btn type2" v-if="btnState.cancel" @click.stop="handleClick('cancel')">取消订单</view>
         <view class="btn type2" v-if="btnState.delete" @click.stop="handleClick('delete')">删除订单</view>
         <view class="btn type2" v-if="btnState.query" @click.stop="handleClick('query')">查看物流</view>
@@ -18,18 +28,22 @@ export default {
         orderInfo: {
             type: Object,
             default: () => {}
+        },
+        hasBottom:{
+            type: Boolean,
+            default: false
         }
     },
     data() {
         return {
             mapState: {
-                fightDetail:[],
-                share: [],
+                fightDetail: [82],
+                fightShare: [81],
                 query: [4, 5, 12, 13, 33, 22, 23, 32, 77],
                 delete: [6],
                 cancel: [0, 111],
                 confirm: [33],
-                again: [33],
+                again: [33, 81, 82],
                 pay: [11, 12, 13, 21, 22, 23, 111]
             },
             buttonCount: 0
@@ -40,8 +54,8 @@ export default {
             return this.initData()
         }
     },
-    watch:{
-        buttonCount(nVal){
+    watch: {
+        buttonCount(nVal) {
             this.$emit('change', {
                 count: nVal
             })
@@ -63,8 +77,8 @@ export default {
 
             for (let key in this.mapState) {
                 btnState[key] = this.mapState[key].includes(orderStatus)
-                if(btnState[key]) {
-                    this.buttonCount ++
+                if (btnState[key]) {
+                    this.buttonCount++
                 }
             }
             return btnState
@@ -80,7 +94,7 @@ export default {
 .cm-order-control-nav {
     padding: 0 24rpx;
     text-align: right;
-
+    // background: #fff;
     .btn {
         display: inline-block;
         width: 160rpx;
@@ -91,6 +105,7 @@ export default {
         box-sizing: border-box;
         text-align: center;
         line-height: 54rpx;
+        vertical-align: middle;
 
         &.type1 {
             border: 1rpx solid #ff457b;

+ 14 - 1
components/cm-module/cm-order-prodcut/cm-order-prodcut.vue

@@ -5,7 +5,10 @@
             <view class="title">{{ goodsData.name || goodsData.productName }}</view>
             <view class="unit">规格:{{ goodsData.productUnit || goodsData.unit }}</view>
             <view class="tags">
-                <view class="tag type3" v-if="goodsData.collageStatus">拼团价</view> 
+                <template v-if="tagsList.length > 0">
+                    <view class="tag type4" v-for="(tag, index) in tagsList" :key="index">{{ tag }}</view>
+                </template>
+                <view class="tag type3" v-if="goodsData.collagePriceFlag">拼团价</view> 
                 <template v-if="goodsData.activeStatus">
                     <view class="tag type1" v-if="userId === goodsData.heUserId">促销</view>
                     <view class="tag type1" v-else>自营</view>
@@ -36,6 +39,10 @@ export default {
         normal: {
             type: Boolean,
             default: false
+        },
+        tagsList:{
+            type: Array,
+            default: ()=>[]
         }
     },
 	computed:{
@@ -146,6 +153,12 @@ export default {
                     color: #fff;
                     border-radius: 4rpx;
                 }
+                &.type4{
+                    border: 1rpx solid #f83c6c;
+                    padding: 0 6rpx;
+                    color: #f83c6c;
+                    border-radius: 4rpx;
+                }
             }
         }
     }

+ 3 - 1
mixins/shareEntry.js

@@ -45,7 +45,9 @@ const shareEntry = {
                 0: '/pages/tabBar/index/index', //首页
                 1: `/pages/goods/product-detail?productId=${this.shareData.productId}&jumpState=${this.shareData.jumpState}`, //商品详情
                 2: `/pages/goods/search?type=share&keyWord=${this.shareData.keyWord}`, // 搜索页面
-                3: `/pages/user/activity/activity?type=share&activityId=${this.shareData.activityId}&userId=${this.shareData.userId}` //活动商品列表
+                3: `/pages/user/activity/activity?type=share&activityId=${this.shareData.activityId}&userId=${this.shareData.userId}`, //活动商品列表
+                4: `/pages/fight-order/fight-share-entry?type=share&collageId=${this.shareData.collageId}&initiatorId=${this.shareData.initiatorId}` // 拼团分享
+
             }
             // 1000 ms后跳转
             setTimeout(() => {

+ 18 - 3
pages/fight-order/components/countdown-box.vue

@@ -1,11 +1,26 @@
 <template>
     <view class="countdown-box">
-        <view class="hour">23</view> <text>:</text> <view class="minute">59</view> <text>:</text>
-        <view class="second">59</view> <text>后结束</text>
+        <view class="hour">{{ countDownTime.hh }}</view> <text>:</text>
+        <view class="minute">{{ countDownTime.mm }}</view> <text>:</text>
+        <view class="second">{{ countDownTime.ss }}</view> <text>后结束</text>
     </view>
 </template>
 
-<script></script>
+<script>
+export default {
+    props: {
+        countDownTime: {
+            type: Object,
+            default: () => ({
+                dd: '00',
+                hh: '00',
+                mm: '00',
+                ss: '00'
+            })
+        }
+    }
+}
+</script>
 
 <style lang="scss" scoped>
 .flex-center-box {

+ 15 - 2
pages/fight-order/components/user-list.vue

@@ -3,11 +3,24 @@
         <view class="user first">
             <image src="https://picsum.photos/100/100?random=1" class="user-head"></image> <text>拼主</text>
         </view>
-        <view class="user"> <image src="https://picsum.photos/100/100?random=2" class="user-head"></image> </view>
+        <view class="user"> <image v-if="status" src="https://picsum.photos/100/100?random=2" class="user-head"></image> </view>
     </view>
 </template>
 
-<script></script>
+<script>
+export default {
+    props: {
+        userList: {
+            type: Object,
+            default: () => ({})
+        },
+        status: {
+            type: Boolean,
+            default: false
+        }
+    }
+}
+</script>
 
 <style lang="scss" scoped>
 .flex-center-box {

+ 0 - 148
pages/fight-order/fight-create-order.vue

@@ -1,148 +0,0 @@
-<template>
-    <view class="figth-create-order">
-        <!-- 收货地址 -->
-        <cm-choose-address :addressData="addressData"></cm-choose-address>
-        <view class="grid"></view>
-        <!-- 订单列表 -->
-        <view class="order-list">
-            <view class="order-section">
-                <!-- 供应商 -->
-                <view class="origin">
-                    <image class="cover" src="https://picsum.photos/100/100?random=1"></image>
-                    <view class="name">华熙生物</view>
-                </view>
-                <!-- 商品列表 -->
-                <view class="goods-list">
-                    <!-- 商品信息 -->
-                    <view class="order-goods"><cm-order-prodcut></cm-order-prodcut></view>
-                    <view class="order-goods"><cm-order-prodcut></cm-order-prodcut></view>
-                </view>
-                <!-- 合计 -->
-                <view class="total-price"> <text>合计:</text> <text class="price">¥900.00</text> </view>
-                <!-- 留言 -->
-                <view class="remark">
-                    <view class="label">留言:</view> <input class="control" type="text" placeholder="请输入内容" />
-                </view>
-            </view>
-        </view>
-        <view class="grid"></view>
-        <!-- 优惠券 -->
-        <cm-order-coupon-section></cm-order-coupon-section>
-        <view class="grid"></view>
-        <!-- 运费 -->
-        <cm-order-freight-section></cm-order-freight-section>
-        <!-- 提交导航 -->
-        <cm-order-submit-nav></cm-order-submit-nav>
-    </view>
-</template>
-
-<script>
-import CmChooseAddress from '@/components/cm-module/cm-choose-address/cm-choose-address.vue'
-import CmOrderProdcut from '@/components/cm-module/cm-order-prodcut/cm-order-prodcut.vue'
-import CmOrderSubmitNav from '@/components/cm-module/cm-order-submit-nav/cm-order-submit-nav.vue'
-import CmOrderCouponSection from '@/components/cm-module/cm-order-coupon-section/cm-order-coupon-section.vue'
-import CmOrderFreightSection from '@/components/cm-module/cm-order-freight-section/cm-order-freight-section.vue'
-
-export default {
-    components: {
-        CmOrderProdcut,
-        CmChooseAddress,
-        CmOrderSubmitNav,
-        CmOrderCouponSection,
-        CmOrderFreightSection
-    },
-    data() {
-        return {
-            addressData: {}
-        }
-    }
-}
-</script>
-
-<style lang="scss" scoped>
-.figth-create-order {
-    background: #f7f7f7;
-    min-height: 100vh;
-}
-
-.grid {
-    width: 100%;
-    height: 20rpx;
-    background: #f7f7f7;
-}
-
-.order-list {
-    background: #fff;
-
-    .order-section {
-        padding: 38rpx 0;
-        margin-top: 20rpx;
-        &:first-child {
-            margin-top: 0;
-        }
-    }
-
-    .goods-list {
-        .order-goods {
-            padding-top: 32rpx;
-            &:first-child {
-                padding-top: 0;
-            }
-        }
-    }
-
-    .origin {
-        padding: 0 24rpx;
-        margin-bottom: 16rpx;
-        display: flex;
-        justify-content: flex-start;
-        align-items: center;
-        .cover {
-            width: 56rpx;
-            height: 56rpx;
-            border-radius: 4rpx;
-        }
-        .name {
-            margin-left: 16rpx;
-            font-size: 30rpx;
-            color: #333333;
-        }
-    }
-}
-
-.total-price {
-    padding: 24rpx;
-    text-align: right;
-    font-size: 26rpx;
-    color: #333;
-    background: #fff;
-
-    .price {
-        color: #ff457b;
-    }
-}
-
-.remark {
-    padding: 0 24rpx;
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    background: #fff;
-
-    .label {
-        width: 78rpx;
-        font-size: 26rpx;
-        color: #999999;
-        margin-right: 16rpx;
-    }
-
-    .control {
-        flex: 1;
-        font-size: 26rpx;
-        color: #333333;
-        padding: 8rpx 16rpx;
-        background: #f7f7f7;
-        border-radius: 8rpx;
-    }
-}
-</style>

+ 83 - 47
pages/fight-order/fight-detail.vue

@@ -1,40 +1,44 @@
 <template>
     <view class="fight-detail">
+        <tui-skeleton v-if="isRequest" loadingType="2"></tui-skeleton>
         <view class="row">
             <view class="fight-tip">
                 <view class="success" v-if="success">恭喜您,拼团成功!</view>
-                <view v-else>还差<text>1</text>人,赶快邀请好友来拼单吧!</view>
+                <view v-else
+                    >还差<text>{{ collageData.needNum }}</text
+                    >人,赶快邀请好友来拼单吧!</view
+                >
             </view>
-            
+
             <!-- 成功 -->
             <template v-if="success">
-                <user-list></user-list>
+                <user-list :status="success"></user-list>
             </template>
             <!-- 等待完成 -->
             <template v-else>
-               <!-- 倒计时 -->
-               <countdown-box></countdown-box>
+                <!-- 倒计时 -->
+                <countdown-box :countDownTime="countDownTime"></countdown-box>
             </template>
-            
+
             <!-- 操作 -->
             <view class="fight-control success" v-if="success">
                 <view class="btn type1" @click="handleClick(1)">去首页逛逛</view>
                 <view class="link" @click="handleClick(3)">查看订单详情 ></view>
             </view>
             <view class="fight-control" v-else>
-                <button class="btn type1" @click="handleClick(2)">邀请好友拼单</button>
+                <button class="btn type1" @click="handleClick(2)" open-type="share">邀请好友拼单</button>
                 <view class="btn type2" @click="handleClick(1)">去首页逛逛</view>
             </view>
-            
+
             <!-- 商品 + 用户信息 -->
             <template v-if="!success">
                 <view class="grid"></view>
                 <!-- 拼单用户列表 -->
-                <user-list></user-list>
+                <user-list :status="success"></user-list>
                 <view class="line"></view>
                 <view class="goods-info">
-                    <image src="https://picsum.photos/100/100?random=3" class="cover"></image>
-                    <view class="title">肌本演绎360愉悦修护套组 PLUS 尊享版防晒修复 补水保湿</view>
+                    <image :src="collageData.productImage" class="cover"></image>
+                    <view class="title" v-text="collageData.productName"></view>
                 </view>
             </template>
         </view>
@@ -44,49 +48,56 @@
 <script>
 import UserList from './components/user-list.vue'
 import CountdownBox from './components/countdown-box.vue'
+import orderShare from '@/pages/order/mixins/orderShare.js'
+import { mapGetters } from 'vuex'
+
 export default {
     components: {
         UserList,
         CountdownBox
     },
-    computed:{
-        success(){
-            return true
+    computed: {
+        ...mapGetters(['userId', 'hasLogin']),
+        success() {
+            return this.collageData.memberNum === this.collageData.existNum
         }
     },
-    data(){
-        return{}
-    },
-    onShareTimeline(e) {
-        // 加密参数
-        const shareData = {
-            type: 4,
-            inviteUserId: this.userId
-        }
-        // 加密
-        const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
+    data() {
         return {
-            title: '哈喽,赶快来参团吧!这件商品拼团买更便宜~~',
-            path: `pages/tabBar/index/index?state_str=${state_str}`,
-            imageUrl: 'https://picsum.photos/400/400?random=3'
+            isRequest: true,
+            collageId: '',
+            initiatorId: '',
+            collageData: {},
+            // 自定义标签
+            tagsList: ['2人拼团价'],
+            // 倒计时
+            countDownTime: {},
+            timer: null,
+            // 商品数量
+            count: 1,
+            countVisible: false
         }
     },
+    onLoad(options) {
+        this.collageId = options.collageId
+        this.fetchOrderDetails()
+    },
     onShareAppMessage(e) {
-        // 加密参数
         const shareData = {
             type: 4,
-            inviteUserId: this.userId
+            collageId: this.collageData.collageId,
+            initiatorId: this.userId
         }
-        // 加密
+
         const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
         return {
-            title: '哈喽,赶快来参团吧!这件商品拼团买更便宜~~',
-            path: `pages/tabBar/index/index?state_str=${state_str}`,
-            imageUrl: 'https://picsum.photos/400/400?random=3'
+            title: '哈喽,赶快来参团吧!这件商品拼团买更便宜~',
+            path: `/pages/tabBar/index/index?state_str=${state_str}`,
+            imageUrl: this.collageData.productImage
         }
     },
-    methods:{
-        handleClick(type){
+    methods: {
+        handleClick(type) {
             const clickFunc = {
                 1: this.toHome,
                 2: this.toShare,
@@ -95,16 +106,41 @@ export default {
             clickFunc[type].apply(this)
         },
         // 跳转首页
-        toHome(){
+        toHome() {
             console.log('首页')
+            uni.switchTab({ url: '/pages/tabBar/index/index' })
         },
         // 分享
-        toShare(){
+        toShare() {
             console.log('分享')
         },
         // 跳转订单
-        toOrder(){
+        toOrder() {
             console.log('订单')
+            this.$api.navigateTo(`/pages/order/order-detail?orderId=${this.collageData.orderId}`)
+        },
+        // 获取拼单详情
+        fetchOrderDetails() {
+            console.log('获取拼单详情')
+            this.FightService.OrderCollageDetails({
+                collageId: this.collageId,
+                userId: this.userId
+            }).then(res => {
+                console.log(res)
+                this.collageData = res.data
+                this.countDown()
+                this.isRequest = false
+            })
+        },
+        // 倒计时
+        countDown() {
+            const diffTime = new Date(this.collageData.endTime).getTime()
+            const loadTime = new Date().getTime()
+
+            this.$util.countDown(diffTime, loadTime, {}, item => {
+                this.countDownTime = item.conttainer
+                this.timer = item.t
+            })
         }
     }
 }
@@ -128,12 +164,12 @@ export default {
 .fight-detail {
     background: #f7f7f7;
     min-height: 100vh;
-    
-    .row{
+
+    .row {
         background: #fff;
         overflow: hidden;
     }
-    
+
     .fight-tip {
         @extend .flex-center-box;
         margin-top: 70rpx;
@@ -144,7 +180,7 @@ export default {
         text {
             color: #ff457b;
         }
-        .success{
+        .success {
             font-size: 34rpx;
             color: #333333;
             font-weight: bold;
@@ -158,12 +194,12 @@ export default {
         flex-direction: column;
         margin-top: 48rpx;
         margin-bottom: 48rpx;
-        
-        .success{
+
+        .success {
             margin-bottom: 66rpx;
         }
-        
-        .link{
+
+        .link {
             margin-top: 24rpx;
             font-size: 26rpx;
             line-height: 38rpx;

+ 180 - 24
pages/fight-order/fight-share-entry.vue

@@ -1,36 +1,58 @@
 <template>
     <view class="fight-share-entry">
+        <tui-skeleton v-if="isRequest" loadingType="2"></tui-skeleton>
         <view class="row">
             <!-- 商品信息 -->
-            <cm-order-prodcut :countVisible="false"></cm-order-prodcut>
-            
+            <cm-order-prodcut
+                :countVisible="false"
+                :goodsData="collageData"
+                :normal="true"
+                :tagsList="tagsList"
+            ></cm-order-prodcut>
+
             <view class="service">
                 <view class="iconfont icon-wuyoushouhou"><text>无忧退货</text></view>
                 <view class="iconfont icon-wuyoushouhou"><text>快速退款</text></view>
                 <view class="iconfont icon-wuyoushouhou"><text>正品保证</text></view>
             </view>
-            
-            
+
             <view class="grid t0b48"></view>
-            
+
             <view class="fight-tip">还差<text>1</text>人,赶快邀请好友来拼单吧!</view>
             <!-- 倒计时 -->
-            <countdown-box></countdown-box>
+            <countdown-box :countDownTime="countDownTime"></countdown-box>
 
             <!-- 操作 -->
-            <view class="fight-control">
-                <button class="btn type1" @click="handleClick">立即参团</button>
-            </view>
+            <view class="fight-control"> <button class="btn type1" @click="handleClick">立即参团</button> </view>
 
             <view class="grid t48b48"></view>
             <!-- 拼单用户列表 -->
             <user-list></user-list>
             <view class="line"></view>
             <view class="goods-info">
-                <image src="https://picsum.photos/100/100?random=3" class="cover"></image>
-                <view class="title">肌本演绎360愉悦修护套组 PLUS 尊享版防晒修复 补水保湿</view>
+                <image :src="collageData.productImage" class="cover"></image>
+                <view class="title" v-text="collageData.productName"></view>
             </view>
         </view>
+
+        <!-- 购买数量弹窗 -->
+        <cm-drawer :visible="countVisible" @close="drawerClose" position="bottom">
+            <view class="count">
+                <view class="top">
+                    <image :src="collageData.productImage" class="cover"></image>
+                    <view class="right">
+                        <view class="number">
+                            <text>数量:</text>
+                            <cm-number-box v-model="count" :min="1" :max="2"></cm-number-box>
+                        </view>
+                        <view class="single-price">
+                            <text>单价:¥</text> <text class="price">{{ collageData.price | formatPrice }}</text>
+                        </view>
+                    </view>
+                </view>
+                <view class="btn" @click="buyGroupNow">确认</view>
+            </view>
+        </cm-drawer>
     </view>
 </template>
 
@@ -38,17 +60,38 @@
 import UserList from './components/user-list.vue'
 import CountdownBox from './components/countdown-box.vue'
 import CmOrderProdcut from '@/components/cm-module/cm-order-prodcut/cm-order-prodcut.vue'
+import CmNumberBox from '@/components/cm-module/cm-number-box/cm-number-box.vue'
+import CmDrawer from '@/components/cm-module/cm-drawer/cm-drawer.vue'
+import { mapGetters } from 'vuex'
 export default {
     components: {
         UserList,
         CountdownBox,
-        CmOrderProdcut
+        CmOrderProdcut,
+        CmDrawer,
+        CmNumberBox
     },
     computed: {
-        
+        ...mapGetters(['userId', 'hasLogin'])
     },
     data() {
-        return {}
+        return {
+            isRequest: true,
+            collageId: '',
+            initiatorId: '',
+            collageData: {},
+            // 自定义标签
+            tagsList: ['2人拼团价'],
+            // 倒计时
+            countDownTime: {},
+            timer: null,
+            // 商品数量
+            count: 1,
+            countVisible: false
+        }
+    },
+    beforeDestroy() {
+        clearTimeout(this.timer)
     },
     onShareTimeline(e) {
         // 加密参数
@@ -78,10 +121,87 @@ export default {
             imageUrl: 'https://picsum.photos/400/400?random=3'
         }
     },
+    onLoad(options) {
+        this.collageId = options.collageId
+        this.initiatorId = options.initiatorId
+        setTimeout(() => {
+            this.fetchOrderDetails()
+        }, 2000)
+    },
     methods: {
         handleClick(type) {
-            console.log('拼单')
+            if (!this.hasLogin) {
+                // 保存当前页面链接参数
+                uni.setStorageSync(
+                    'login_redirect_url',
+                    `/pages/fight-order/fight-share-entry?type=share&collageId=${this.collageId}&initiatorId=${
+                        this.initiatorId
+                    }`
+                )
+                this.$api.navigateTo('/pages/login/login')
+                return
+            }
+
+            if (this.userId == this.initiatorId) {
+                this.$util.msg('您不能参与自己发起的拼团')
+                return
+            }
+
+            this.countVisible = true
+        },
+
+        // 拼团购买
+        buyGroupNow() {
+            console.log('拼团购买')
+            let productStp = {
+                allPrice: this.count * this.collageData.price,
+                allCount: this.count,
+                productId: this.collageData.productId,
+                productCount: this.count,
+                heUserId: this.userId,
+                collageFlag: 1,
+                collageId: this.collageId
+            }
+            uni.setStorageSync('commitProductInfo', productStp)
+            this.$api.navigateTo('/pages/order/create-order?type=prodcut')
+            this.countVisible = false
+        },
+
+        countDown() {
+            const diffTime = new Date(this.collageData.endTime).getTime()
+            const loadTime = new Date().getTime()
+
+            this.$util.countDown(diffTime, loadTime, {}, item => {
+                this.countDownTime = item.conttainer
+                this.timer = item.t
+            })
+        },
+        // 获取拼单详情
+        fetchOrderDetails() {
+            this.FightService.OrderCollageDetails({
+                collageId: this.collageId,
+                userId: this.userId
+            }).then(res => {
+                this.collageData = res.data
+                // 拼团已完成
+                if (this.collageData.orderId) {
+                    this.$util.msg('拼团已结束')
+                    setTimeout(() => {
+                        uni.switchTab({ url: '/pages/tabBar/index/index' })
+                    }, 2000)
+                    return
+                }
+                // 拼团未完成
+                this.countDown()
+                this.isRequest = false
+            })
         },
+
+        // 购买数量弹窗关闭
+        drawerClose() {
+            this.count = 1
+            this.countVisible = false
+        }
     }
 }
 </script>
@@ -110,7 +230,7 @@ export default {
         background: #fff;
         overflow: hidden;
     }
-   
+
     .service {
         display: flex;
         justify-content: space-around;
@@ -120,21 +240,19 @@ export default {
         height: 72rpx;
         padding: 0 24rpx;
         margin-top: 64rpx;
-        background: #FFF8FD;
+        background: #fff8fd;
         opacity: 1;
         box-sizing: border-box;
-        
+
         .iconfont {
             font-size: 24rpx;
             line-height: 24rpx;
             text {
-                color: #FF457B;
+                color: #ff457b;
                 margin-left: 4rpx;
             }
         }
     }
-    
-    
 
     .fight-tip {
         @extend .flex-center-box;
@@ -186,12 +304,12 @@ export default {
         width: 750rpx;
         height: 20rpx;
         background: #f7f7f7;
-        &.t48b48{
+        &.t48b48 {
             margin-top: 48rpx;
             margin-bottom: 48rpx;
         }
-        
-        &.t0b48{
+
+        &.t0b48 {
             margin-top: 0;
             margin-bottom: 48rpx;
         }
@@ -227,4 +345,42 @@ export default {
         }
     }
 }
+.count {
+    padding: 60rpx 0;
+    .top {
+        display: flex;
+        justify-content: flex-start;
+        align-items: center;
+        padding: 0 60rpx;
+        .cover {
+            width: 104rpx;
+            height: 104rpx;
+        }
+        .right {
+            margin-left: 24rpx;
+            font-size: 24rpx;
+            color: #333;
+            .single-price {
+                color: #ff457b;
+                margin-top: 24rpx;
+            }
+            .number {
+                display: flex;
+                justify-content: flex-start;
+                align-items: center;
+            }
+        }
+    }
+    .btn {
+        width: 100%;
+        height: 88rpx;
+        margin-top: 32px;
+        background: #ff457b;
+        line-height: 88rpx;
+        text-align: center;
+        color: #ffffff;
+        font-size: 28rpx;
+        border-radius: 44rpx;
+    }
+}
 </style>

+ 13 - 2
pages/login/login.vue

@@ -74,10 +74,11 @@ export default {
             mobileCodeText: '获取验证码',
             codeTime: null,
             isLogin: false,
-            hasProfile: false
+            hasProfile: false,
         }
     },
-    onLoad() {
+    onLoad() { 
+        this.redirectUrl = uni.getStorageInfoSync('login_redirect_url') || ''
         if (this.hasLogin) return this.$api.switchTabTo('/pages/tabBar/index/index')
     },
     created() {
@@ -150,6 +151,16 @@ export default {
                 this.isLogin = true
                 await this.customLogin(this.params)
                 this.isLogin = false
+                
+                if(redirectUrl){
+                    setTimeout(() => {
+                        switchTabTo(redirectUrl)
+                    }, 1500)
+                }else{
+                    setTimeout(() => {
+                        switchTabTo('/pages/tabBar/index/index')
+                    }, 1500)
+                }
             } catch (e) {
                 this.isLogin = false
             }

+ 1 - 0
pages/order/create-order.vue

@@ -269,6 +269,7 @@ export default {
                 this.productIds = productInfo.productId.toString()
                 this.allCount = productInfo.allCount
                 this.params.collageFlag = this.collageFlag = productInfo.collageFlag
+                this.collageId = parseInt(productInfo.collageId) || 0 
             } else {
                 const cartPramsData = uni.getStorageSync('commitCartPramsData')
                 this.subParams.cartType = 1

+ 7 - 5
pages/order/mixins/orderList.js

@@ -14,7 +14,7 @@ const orderList = {
         handleConfirmClick(e) {
             const { type, order } = (this.hanldOrder = e)
             switch (type) {
-
+ 
             // 其他操作
             case 'again':
                 this.buyAgain()
@@ -28,11 +28,13 @@ const orderList = {
                 break
             case 'fightDetail':
                 console.log('拼团详情')
+                this.$api.navigateTo('/pages/fight-order/fight-detail?collageId=' + order.collageId)
                 break
-            case 'share':
-                console.log('邀请好友拼团')
-                break        
-            // 常规操作
+            case 'fightShare':
+                console.log('分享邀请好友拼团')
+                this.$api.navigateTo('/pages/fight-order/fight-detail?collageId=' + order.collageId)
+                break
+                // 常规操作
             case 'cancel':
                 this.modal = true
                 this.modalText = '确认取消该订单吗?'

+ 45 - 0
pages/order/mixins/orderShare.js

@@ -0,0 +1,45 @@
+// 返回数据
+const resultMessage = {}
+
+// 拼团分享格式
+const fightShareMessage = {
+    title: '哈喽,赶快来参团吧!这件商品拼团买更便宜~',
+    path: 'pages/tabBar/index/fight-share-entry',
+    imageUrl: 'https://picsum.photos/200/200'
+}
+
+// 拼团分享
+function handleFightShare(shareData, option) {
+    resultMessage.title = option.title
+    resultMessage.path = option.path
+    resultMessage.imageUrl = option.imageUrl
+    return {
+        type: 4,
+        collageId: shareData.collageId,
+        initiatorId: shareData.buyUserId  
+    }
+}
+
+// 订单分享混入对象
+const orderShare = {
+    onShareAppMessage(e) {
+        console.log(e)
+        let shareData = null
+        if (e.from === 'button') {
+            // 拼单
+            if (e.target.id === 'fightShare') {
+                shareData = handleFightShare(e.target.dataset.share, fightShareMessage)
+            }
+        }
+        console.log(shareData)
+        // 加密参数
+        const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
+        return {
+            title: resultMessage.title,
+            path: `/pages/tabBar/index/index?state_str=${state_str}`,
+            imageUrl: resultMessage.imageUrl
+        }
+    }
+}
+
+export default orderShare

+ 13 - 11
pages/order/order-detail.vue

@@ -42,11 +42,12 @@
 		<cm-order-information :orderInfo="orderInfo"></cm-order-information>
 
 		<!-- 操作 -->
-		<view class="order-control" v-if="hasControlNav">
+		<view class="order-control" v-if="hasControlNav" :class="{'has-bottom': isIphoneX}">
 			<cm-order-control-nav
 				:orderInfo="orderInfo"
 				@confirm="handleConfirmClick"
-				@change="getCount"
+                :hasBottom="isIphoneX"
+                @change="getButtonCount"
 			></cm-order-control-nav>
 		</view>
 
@@ -106,7 +107,6 @@ export default {
 			shopOrderList: [],
 			orderInfo: {},
 			userInfo: {},
-			buttonCount: 0
 		}
 	},
 	computed: {
@@ -116,8 +116,8 @@ export default {
 			return this.userIdentity === 2
 		},
 		hasControlNav() {
-			return this.orderInfo.buyUserId === this.userId && this.buttonCount > 0
-		}
+			return this.orderInfo.buyUserId === this.userId
+		},
 	},
 	onLoad(option) {
 		this.orderId = option.orderId
@@ -137,19 +137,18 @@ export default {
 					this.shopOrderList = res.data.shopOrderList
 					this.orderInfo = res.data.order
 					this.userInfo = res.data.userInfo
+                    this.isRequest = false
 				})
 				.catch(err => {
 					this.$util.modal('提示', '订单查询失败,请稍后重试~', '确定', '', false, () => {
 					    this.$api.switchTabTo('/pages/tabBar/index/index')
 					})
 				})
-				.finally(() => {
-					this.isRequest = false
-				})
 		},
-		getCount(e) {
-			this.buttonCount = e.count
-		}
+        getButtonCount(e){
+            this.buttonCount = e.count
+            console.log(e.count)
+        }
 	}
 }
 </script>
@@ -268,6 +267,9 @@ export default {
 		align-items: center;
 		bottom: 0;
 		background: #fff;
+        &.has-bottom{
+            bottom: 50rpx;
+        }
 	}
 }
 </style>

+ 3 - 1
pages/order/order-list.vue

@@ -86,7 +86,7 @@
 							<view class="total">
 								<view class="count">共{{ orderInfo.productCount }}件商品</view>
 								<view class="status">
-									<template v-if="['31', '32', '33'].includes(orderInfo.status)">
+									<template v-if="['31', '32', '33', '82', '83'].includes(orderInfo.status)">
 										<text class="label">已支付:</text>
 										<text>¥{{ orderInfo.receiptAmount | formatPrice }}</text>
 									</template>
@@ -264,6 +264,8 @@ export default {
 	beforeDestroy() {
 		this.$off('orderAction')
 	},
+    
+    
 	methods: {
 		// 导航栏初始化
 		headerNavInit(info){

+ 14 - 7
pages/tabBar/user/index.vue

@@ -38,19 +38,19 @@
                             <tui-badge :scaleRatio="0.8" type="danger">{{ paymentCount | countNum }}</tui-badge>
                         </view>
                     </view>
-                    <view class="order-nav-item" @click="OrderNavigator(2)">
+                    <view class="order-nav-item" @click="OrderNavigator(3)">
                         <image :src="StaticUrl + 'icon-order-2@2x.png'" mode="widthFix"></image> <text>待发货</text>
                         <view class="tui-badge tui-badge-box" v-if="hasLogin && waitShipmentsCount > 0">
                             <tui-badge :scaleRatio="0.8" type="danger">{{ waitShipmentsCount | countNum }}</tui-badge>
                         </view>
                     </view>
-                    <view class="order-nav-item" @click="OrderNavigator(3)">
+                    <view class="order-nav-item" @click="OrderNavigator(4)">
                         <image :src="StaticUrl + 'icon-order-3@2x.png'" mode="widthFix"></image> <text>已发货</text>
                         <view class="tui-badge tui-badge-box" v-if="hasLogin && shipmentsCount > 0">
                             <tui-badge :scaleRatio="0.8" type="danger">{{ shipmentsCount | countNum }}</tui-badge>
                         </view>
                     </view>
-                    <view class="order-nav-item" @click="OrderNavigator(3)">
+                    <view class="order-nav-item" @click="OrderNavigator(5)">
                         <image :src="StaticUrl + 'icon-order-4@2x.png'" mode="widthFix"></image> <text>退货/款</text>
                         <view class="tui-badge tui-badge-box" v-if="hasLogin && salesReturnCount > 0">
                             <tui-badge :scaleRatio="0.8" type="danger">{{ salesReturnCount | countNum }}</tui-badge>
@@ -156,10 +156,14 @@ export default {
                     this.waitShipmentsCount = data.waitShipmentsCount //待收货
                     this.shipmentsCount = data.shipmentsCount //已发货
                     this.salesReturnCount = data.salesReturnCount //退货/款
+                    this.stopPullDownRefresh(500)
                 })
                 .catch(error => {
                     this.$util.msg(error.msg, 2000)
                 })
+                .finally(()=>{
+                    this.stopPullDownRefresh(5000)
+                })
         },
         handleContact(e) {
             //客服
@@ -177,16 +181,19 @@ export default {
             } else {
                 this.$api.navigateTo('/pages/login/login')
             }
+        },
+        stopPullDownRefresh(time){
+            setTimeout(()=>{
+                uni.stopPullDownRefresh()
+            },time)
         }
     },
     onPullDownRefresh() {
         //下拉刷新
         if (this.hasLogin) {
-            this.GetUserInfo()
-            setTimeout(() => {
-                uni.stopPullDownRefresh()
-            }, 2000)
+            this.GetUserInfoPersonal()
         } else {
+            this.$api.navigateTo('/pages/login/login')
             uni.stopPullDownRefresh()
         }
     }

+ 15 - 0
services/fight.service.js

@@ -0,0 +1,15 @@
+export default class FightService {
+    constructor(AjaxService) {
+        Object.assign(this, { AjaxService })
+        this.name = 'LocateService'
+    }
+    
+    /* 拼团订单详情 */
+    OrderCollageDetails(data = {}) {
+        return this.AjaxService.get({
+            url: '/order/collage/details',
+            data,
+            isLoading: false,
+        })
+    }
+}

+ 3 - 0
services/index.js

@@ -9,6 +9,7 @@ import PayService from './pay.service'
 import OrderService from './order.service'
 import PublicService from './public.service.js'
 import CouponService from './coupon.service.js'
+import FightService from './fight.service.js'
 
 export const commonService = new CommonService(ajaxService)
 export const locateService = new LocateService(ajaxService)
@@ -18,6 +19,7 @@ export const payService = new PayService(ajaxService)
 export const orderService = new OrderService(ajaxService)
 export const publicService = new PublicService(ajaxService)
 export const couponService = new CouponService(ajaxService)
+export const fightService = new FightService(ajaxService)
 
 const install = (Vue) => {
     console.log('初始化挂载接口方法')
@@ -30,6 +32,7 @@ const install = (Vue) => {
     Vue.prototype.OrderService = orderService
     Vue.prototype.PublicService = publicService
     Vue.prototype.CouponService = couponService
+    Vue.prototype.FightService = fightService
 }
 
 export default install

+ 3 - 3
store/modules/user.js

@@ -68,9 +68,9 @@ const actions = {
                 dispatch('coupon/initReceiveCouponCount', null, { root: true }) // 获取已领取优惠券数量
                 // 登录成功提示
                 showMsg('登录成功', 1500, false, 'success')
-                setTimeout(() => {
-                    switchTabTo('/pages/tabBar/index/index')
-                }, 1500)
+                // setTimeout(() => {
+                //     switchTabTo('/pages/tabBar/index/index')
+                // }, 1500)
             })
             .catch(error => {
                 showMsg(error.msg, 2000)