shenxin 4 anni fa
parent
commit
a7dbfb43fd

+ 3 - 2
src/App.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-01-25 11:32:04
- * @LastEditTime: 2021-03-25 21:46:18
+ * @LastEditTime: 2021-03-29 14:46:24
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \rebatedine-mini\src\App.vue
@@ -24,10 +24,11 @@ export default {
       const { code, data } = await getSystemConfig()
       if (code === 200) {
         this.$store.state.ossImgResize = data.oss_img_resize
-        this.$store.state.enable_commission = data.enable_commission
+        this.$store.state.enable_commission = data.enable_commission * 1
         this.$store.state.commission_banner = data.commission_banner
         this.$store.state.min_apply_amount = data.min_apply_amount
         this.$store.state.joinTemplateIds = JSON.parse(data.join_template_ids)
+        this.$store.state.home_minipro = JSON.parse(data.home_minipro)
       }
     }
   }

+ 3 - 3
src/api/request.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-01-25 11:32:04
- * @LastEditTime: 2021-03-19 11:00:41
+ * @LastEditTime: 2021-03-29 14:54:29
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \rebatedine-mini\src\api\request.js
@@ -14,9 +14,9 @@ import { USER_TOKEN } from '../store/storageKeys'
 
 export default {
   config: {
-    // baseUrl: 'https://apitest.qcbwc.cn/bwc/',
+    // baseUrl: 'http://localhost:18333/',
     baseUrl:
-      process.env.NODE_ENV === 'development'
+      process.env.NODE_ENV === 'development1'
         ? 'https://apitest.topboom0912.com/bwc/'
         : 'https://api.qcbwc.cn/',
     data: '',

+ 2 - 2
src/components/activityCard.vue

@@ -9,13 +9,13 @@
       <view class="card-title u-font-28 bold u-line-1">{{value.title}}</view>
       <view class="card-desc u-flex u-content-color u-m-t-4 u-m-b-12">
         <view>平台:{{value.plat_type | platFilter}}</view>
-        <view class="u-font-22 line-32 u-flex-1">({{value.start_time | timeFilter(this)}}---{{value.end_time | timeFilter(this)}})</view>
+        <view class="u-font-22 line-32 u-flex-1">({{value.start_time | timeFilter(this)}}-{{value.end_time | timeFilter(this)}})</view>
         <view v-if="value.distance">{{(value.distance / 1000).toFixed(1)}}km</view>
         <view v-else>距离&gt;99km</view>
       </view>
       <view class="card-footer u-flex u-col-bottom">
         <view class="u-flex-1 u-col-bottom">
-          <view class="u-content-color u-p-b-12">{{value.activity_type === 2 ? '门槛:' + (value.floor_price / 100).toFixed(2) + '元' : ''}}</view>
+          <view class="u-content-color u-p-b-12">{{value.activity_type === 2 ? '门槛:实付' + (value.floor_price) + '元' : ''}}</view>
           <view class="u-flex u-flex-1 u-col-bottom">
             <view class="u-content-color line-34">返利</view>
             <block v-if="value.activity_type * 1 === 1">

+ 11 - 1
src/components/orderCard.vue

@@ -31,7 +31,8 @@
       <block v-if="value.join_status * 1 === 1">
         <view class="u-flex u-row-right">
           <button class="cancel-btn u-font-24"
-                  @click.stop="cancelSignUp">取消报名</button>
+                  @click.stop="cancelSignUp"
+                  v-if="!isExpire()">取消报名</button>
           <button class="submit-btn u-font-24 u-m-l-24"
                   @click.stop="submitResult">提交结果</button>
         </view>
@@ -56,6 +57,15 @@ export default {
     }
   },
   methods: {
+    isExpire () {
+      const nowTime = this.$dayjs()
+      const now = nowTime.format('HH:mm:ss')
+      console.log(this.value)
+      if (this.value.end_time < now) {
+        return true
+      }
+      return false
+    },
     clickCard () {
       this.$emit('click-card', this.value)
     },

+ 41 - 1
src/pages/index.vue

@@ -25,6 +25,13 @@
       <view class="activity-flow">
         <activity-flow></activity-flow>
       </view>
+      <view class="activity-top">
+        <image v-for="(item,index) in homeMiniPro"
+               :src="item.img"
+               :key="index"
+               mode="widthFix"
+               @click="dealJumpInfo(item)" />
+      </view>
     </view>
     <view class="index-body u-m-t-56">
       <u-sticky :enable="enable"
@@ -142,6 +149,9 @@ export default {
     }
   },
   computed: {
+    homeMiniPro () {
+      return this.$store.state.home_minipro
+    },
     navHeight () {
       return ((uni.getMenuButtonBoundingClientRect().top) + (uni.getMenuButtonBoundingClientRect().height - 22) / 2)
     },
@@ -171,6 +181,7 @@ export default {
         }
       })
     })
+    this.updateHeightIfNeeded()
   },
   onHide () {
     this.enable = true
@@ -277,7 +288,9 @@ export default {
     // 点击banner事件
     bannerClick (index) {
       const banner = this.bannerList[index]
-      console.log(banner)
+      this.dealJumpInfo(banner)
+    },
+    dealJumpInfo (banner) {
       switch (banner.jump_type * 1) {
         case 1:
           uni.navigateTo({
@@ -307,6 +320,22 @@ export default {
           break
         default:
       }
+    },
+    updateHeightIfNeeded () {
+      let height = 568
+      const count = this.$store.state.home_minipro.length
+      if (count > 0) {
+        height += 186 * count + (count - 1) * 16 + 64
+      }
+      if (this.firstHeight !== height) {
+        this.firstHeight = height
+        this.$forceUpdate()
+      }
+    }
+  },
+  watch: {
+    homeMiniPro () {
+      this.updateHeightIfNeeded()
     }
   },
   filters: {
@@ -358,6 +387,17 @@ export default {
     padding-top: 36px;
     background-color: #fff;
   }
+  .activity-top {
+    margin: 36rpx 0 0 0;
+    image:last-child {
+      width: 100%;
+      margin-bottom: 36rpx;
+    }
+    image {
+      width: 100%;
+      margin-bottom: 16rpx;
+    }
+  }
   .index-tabs {
     padding: 24px 28px 16px;
   }

+ 7 - 2
src/pages/my.vue

@@ -20,7 +20,8 @@
       </block>
     </view>
     <view class="commission"
-          @click="jumpToCommissionApply">
+          @click="jumpToCommissionApply"
+          v-if="isCommissionEnable">
       <view class="left">
         <image src="~@/static/icon/icon_commission.png"
                class="icon"></image>
@@ -33,7 +34,8 @@
     </view>
     <image class="banner"
            :src="bannerUrl"
-           @click="jumpToCommission"></image>
+           @click="jumpToCommission"
+           v-if="isCommissionEnable"></image>
     <view class="divider"></view>
     <view class="item-list">
       <view class="item u-flex"
@@ -71,6 +73,9 @@ export default {
     return {}
   },
   computed: {
+    isCommissionEnable () {
+      return this.$store.state.enable_commission * 1 === 1
+    },
     userInfo () {
       return this.$store.state.userInfo
     },

+ 118 - 36
src/pagesSub/activity/activityDetail.vue

@@ -107,24 +107,37 @@
     <block v-if="status">
       <fixed-bottom @get-height="getFooterHeight">
         <view class="bottom-footer u-flex">
-          <block v-if="status * 1 === 1 || status * 1 === 2">
+          <block v-if="(status * 1 === 2)">
             <view class="u-flex-1">
-              <view class="line-34 bold">距活动结束还有:</view>
+              <view class="line-34 bold">{{'距截止提交还有:'}}</view>
               <view class="u-font-20 u-content-color line-28">{{remainingTime}}</view>
             </view>
-            <block v-if="status * 1 === 1">
-              <button class="sign-up-btn u-font-30 bold line-42"
-                      @click="join">我要报名</button>
-            </block>
             <block v-if="status * 1 === 2">
               <view class="u-flex">
                 <button class="canel-btn u-font-28 line-40"
-                        @click="cancelJoin">取消报名</button>
-                <button class="submit-btn u-font-28 line-40 u-m-l-16"
+                        @click="cancelJoin"
+                        v-show="!isExpire">取消报名</button>
+                <button :class="isExpire ? 'sign-up-btn u-font-28 line-40 u-m-l-16' : 'submit-btn u-font-28 line-40 u-m-l-16'"
                         @click="toSubmiteOrder">提交结果</button>
               </view>
             </block>
           </block>
+          <block v-if="status * 1 === 1">
+            <block v-if="isExpire">
+              <button class="end-btn u-m-l-12"
+                      disabled
+                      v-if="status * 1 === 1">已结束</button>
+            </block>
+            <view class="u-flex-1"
+                  v-if="!isExpire">
+              <view class="line-34 bold">{{isStart ? '距活动结束还有:' : '距活动开始还有:'}}</view>
+              <view class="u-font-20 u-content-color line-28">{{remainingTime}}</view>
+            </view>
+            <block v-if="status * 1 === 1 && !isExpire">
+              <button :class="isStart ? 'sign-up-btn u-font-30 bold line-42' : 'sign-up-btn u-font-30 bold line-42'"
+                      @click="join">{{isStart ? '我要报名' : '即将开始'}}</button>
+            </block>
+          </block>
           <block v-if="status * 1 === 3 || status * 1 === 4">
             <block v-if="status * 1 === 3">
               <view class="u-flex-1">
@@ -158,11 +171,17 @@
         </view>
       </fixed-bottom>
     </block>
-    <view class="fixed-copy">
-      <view class="btn-copy u-font-22"
-            :style="{marginBottom: `${footerHeight}rpx`}"
-            v-show="detail.search_key"
-            @click.stop="copyShopName">复制店名</view>
+    <view class="fixed-copy"
+          :style="{marginBottom: `${footerHeight}rpx`}">
+      <view class="copy-container">
+        <image src="@/static/common/share.png"
+               mode="scaleToFill"
+               v-if="isCommissionEnable"
+               @click="onClickShare" />
+        <view class="btn-copy u-font-22"
+              v-show="detail.search_key"
+              @click.stop="copyShopName">复制店名</view>
+      </view>
     </view>
   </view>
 </template>
@@ -203,9 +222,35 @@ export default {
     }
   },
   computed: {
+    isCommissionEnable () {
+      return this.$store.state.enable_commission * 1 === 1
+    },
     userId () {
       return this.$store.state.userInfo.token
     },
+    isStart () {
+      if (!this.nowTime) {
+        return true
+      }
+      const now = this.nowTime.format('HH:mm:ss')
+      console.log(this.detail.start_time)
+      console.log(now)
+      if (this.detail.start_time < now) {
+        console.log(this.detail.start_time < now)
+        return true
+      }
+      return false
+    },
+    isExpire () {
+      if (!this.nowTime) {
+        return false
+      }
+      const now = this.nowTime.format('HH:mm:ss')
+      if (this.detail.end_time < now) {
+        return true
+      }
+      return false
+    },
     businessHours () {
       const date = this.$dayjs(`${this.detail.start_date}`).format('YYYY年MM月DD日')
       const start = this.$dayjs(`${this.detail.start_date} ${this.detail.start_time}`).format('HH:mm')
@@ -225,8 +270,6 @@ export default {
         return 1
       } else if (this.detail.join_status === 6) {
         return 6
-      } else if (this.remainingTime === 0) {
-        return 6
       } else if (this.detail.join_count === this.detail.join_number && this.detail.join_count) {
         return 7
       } else if (this.detail.join_status === 0) {
@@ -237,13 +280,23 @@ export default {
     },
     remainingTime () {
       if (!this.detail.end_time) { return }
-      const endTime = this.$dayjs(`${this.$dayjs().format('YYYY-MM-DD')} ${this.detail.end_time}`)
-      if (isNaN(endTime.diff(this.nowTime, 's'))) { return }
-      if (!isNaN(endTime.diff(this.nowTime, 's')) && endTime.diff(this.nowTime, 's') === 0) {
-        clearTimeout(this.timer)
-        return 0
+      if (this.status * 1 === 2) {
+        const endTime = this.$dayjs(`${this.$dayjs().format('YYYY-MM-DD 23:59:59')}`)
+        if (isNaN(endTime.diff(this.nowTime, 's'))) { return }
+        return this.$dayjs(endTime.diff(this.nowTime)).subtract(8, 'h').format('HH小时mm分ss秒')
+      }
+      if (this.isStart) {
+        const endTime = this.$dayjs(`${this.$dayjs().format('YYYY-MM-DD')} ${this.detail.end_time}`)
+        if (isNaN(endTime.diff(this.nowTime, 's'))) { return }
+        if (!isNaN(endTime.diff(this.nowTime, 's')) && endTime.diff(this.nowTime, 's') === 0) {
+          clearTimeout(this.timer)
+          return 0
+        }
+        return this.$dayjs(endTime.diff(this.nowTime)).subtract(8, 'h').format('HH小时mm分ss秒')
+      } else {
+        const endTime = this.$dayjs(`${this.$dayjs().format('YYYY-MM-DD')} ${this.detail.start_time}`)
+        return this.$dayjs(endTime.diff(this.nowTime)).subtract(8, 'h').format('HH小时mm分ss秒')
       }
-      return this.$dayjs(endTime.diff(this.nowTime)).subtract(8, 'h').format('HH小时mm分ss秒')
     }
   },
   watch: {
@@ -300,6 +353,9 @@ export default {
     }
   },
   methods: {
+    onClickShare () {
+      uni.navigateTo({ url: '/pagesSub/commission/invite' })
+    },
     getShareUrl () {
       let url = `/pagesSub/activity/activityDetail?id=${this.detail.id}`
       if (this.userInfo) {
@@ -344,6 +400,7 @@ export default {
       const { code, data } = await getActivityDetail(params)
       if (code === 200) {
         this.detail = data
+        this.nowTime = this.$dayjs()
       }
       uni.stopPullDownRefresh()
     },
@@ -396,6 +453,13 @@ export default {
     },
     // 我要报名
     join () {
+      if (!this.isStart) {
+        uni.showToast({
+          title: '活动还未开始',
+          icon: 'none'
+        })
+        return
+      }
       uni.requestSubscribeMessage({
         tmplIds: this.$store.state.joinTemplateIds,
         complete: () => {
@@ -494,23 +558,32 @@ export default {
   .fixed-copy {
     position: fixed;
     bottom: 0;
+    right: 0;
     z-index: 99;
-    width: 100%;
-    display: flex;
-    justify-content: flex-end;
     padding-bottom: 16rpx;
-    .btn-copy {
-      width: 72rpx;
-      height: 72rpx;
-      text-align: center;
-      padding: 8rpx;
-      margin-right: 16rpx;
-      background: #111111;
-      box-shadow: 0px 1px 4px 0px rgba(17, 17, 17, 0.6);
-      opacity: 0.8;
-      color: #eaebec;
-      font-weight: 400;
-      border-radius: 36rpx;
+
+    .copy-container {
+      padding-right: 24rpx;
+      align-items: center;
+      display: flex;
+      flex-direction: column;
+      image {
+        width: 122rpx;
+        height: 122rpx;
+      }
+      .btn-copy {
+        width: 72rpx;
+        height: 72rpx;
+        text-align: center;
+        padding: 8rpx;
+        background: #111111;
+        box-shadow: 0px 1px 4px 0px rgba(17, 17, 17, 0.6);
+        opacity: 0.8;
+        color: #eaebec;
+        font-weight: 400;
+        border-radius: 36rpx;
+        margin-top: 32rpx;
+      }
     }
   }
   .over-view {
@@ -593,6 +666,15 @@ export default {
       background-color: $u-type-primary;
       white-space: nowrap;
     }
+
+    .sign-up-btn-disable {
+      padding: 24px 128px;
+      width: 374px;
+      height: 88px;
+      border-radius: 44px;
+      white-space: nowrap;
+    }
+
     .canel-btn,
     .submit-btn {
       padding: 16px 40px;

+ 2 - 2
src/pagesSub/commission/invite.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-03-18 11:16:06
- * @LastEditTime: 2021-03-19 15:44:14
+ * @LastEditTime: 2021-03-29 15:02:40
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \rebatedine-mini\src\pagesSub\commission\invite.vue
@@ -29,7 +29,7 @@
       <view class="middle-top">
         <view class="middle-top-left">
           <view class="middle-top-left-top">
-            <text class="number">{{(userInfo.total_amount/100).toFixed(0)}}</text>
+            <text class="number">{{(userInfo.total_amount/100).toFixed(1)}}</text>
             <text class="unit">元</text>
           </view>
           <text class="tips">累计收益</text>

+ 17 - 3
src/pagesSub/order/submitOrder.vue

@@ -51,7 +51,10 @@
       <view class="item u-border-bottom">
         <view class="label u-flex">
           <view class="icon-bt"></view>
-          <view>订单截图<span class="u-content-color u-font-30 line-42">(含店名与实付金额)</span></view>
+          <view>订单截图<span class="u-content-color u-font-30 line-42">(含店名与实付金额)</span>
+            <span class="rule u-m-l-32"
+                  @click="showExample(1)">查看案例</span>
+          </view>
         </view>
         <view class="u-flex u-flex-wrap u-p-t-40">
           <block v-for="(item, index) in imgList1"
@@ -71,7 +74,10 @@
       <view class="item u-border-bottom">
         <view class="label u-flex">
           <view class="icon-bt"></view>
-          <view>订单截图<span class="u-content-color u-font-30 line-42">(含下单时间与订单号)</span></view>
+          <view>订单截图<span class="u-content-color u-font-30 line-42">(含下单时间与订单号)</span>
+            <span class="rule u-m-l-32"
+                  @click="showExample(2)">查看案例</span>
+          </view>
         </view>
         <view class="u-flex u-flex-wrap u-p-t-40">
           <block v-for="(item, index) in imgList2"
@@ -114,7 +120,9 @@
       <view class="item u-border-bottom">
         <view class="label u-flex">
           <view class="icon-bt"></view>
-          <view>浏览轨迹<span class="u-content-color u-font-30 line-42">(搜索活动门店关键词找到该门店的截图)</span>
+          <view>浏览轨迹<span class="u-content-color u-font-30 line-42">(门店列表截图)</span>
+            <span class="rule u-m-l-32"
+                  @click="showExample(3)">查看案例</span>
           </view>
         </view>
         <view class="u-flex u-flex-wrap u-p-t-40">
@@ -190,6 +198,12 @@ export default {
     this.form.id = options.userActivityId
   },
   methods: {
+    showExample (index) {
+      uni.previewImage({
+        urls: ['https://image.qcbwc.cn/example/example_' + index + '.png'],
+        success: (result) => { }
+      })
+    },
     // 提交订单信息
     async submitForm () {
       const params = JSON.parse(JSON.stringify(this.form))

BIN
src/static/common/share.png


+ 15 - 5
src/store/index.js

@@ -15,6 +15,7 @@ const store = new Vuex.Store({
     openid: uni.getStorageSync(storageKeys.OPENIDID) || '', // 微信code换取openid
     userInfo: uni.getStorageSync(storageKeys.USER_INFO) || {}, // 用户信息
     cateId: '',
+    home_minipro: [],
     joinTemplateIds: ['JkOW6dK9TarfbXHJ5r-GfxuCpgmiSxi01yEGbhhW_Rw'],
     INVITE_ID: uni.getStorageSync(storageKeys.INVITE_ID) || '',
     lat: uni.getStorageSync(storageKeys.LAT) || '',
@@ -158,14 +159,23 @@ const store = new Vuex.Store({
     },
     toOtherApplte ({ commit, state, dispatch }, platType) {
       let appId = ''
-      if (platType * 1 === 8) {
-        appId = 'wxece3a9a4c82f58c9'
-      } else if (platType * 1 === 9) {
-        appId = 'wx2c348cf579062e56'
+      let path = ''
+      if (platType * 1 === 8 || platType * 1 === 9) {
+        if (platType * 1 === 8) {
+          appId = 'wxece3a9a4c82f58c9'
+        } else if (platType * 1 === 9) {
+          appId = 'wx2c348cf579062e56'
+        }
+      } else {
+        const json = JSON.parse(platType)
+        const info = json
+        appId = info.appid
+        path = info.path
       }
+
       uni.navigateToMiniProgram({
         appId: appId,
-        path: ''
+        path: path
       })
     }
   }