Parcourir la source

feat(merchant):优惠券接口对接

yizhiyang il y a 1 an
Parent
commit
cb6a136874
2 fichiers modifiés avec 50 ajouts et 6 suppressions
  1. 3 3
      src/pages/merchant/mine/index.vue
  2. 47 3
      src/pages/merchant/store/couponManage.vue

+ 3 - 3
src/pages/merchant/mine/index.vue

@@ -6,9 +6,9 @@
       <view class="mine__person--info">
         <view @click="$Router.push('/pages/merchant/mine/personalInfo')">
           <image
-            :src="merchantInfo.logo"
+            :src="merchantInfo.merchant.logo"
             style="width: 140rpx; height: 140rpx; border-radius: 50%"
-            v-if="merchantInfo.logo"
+            v-if="merchantInfo.merchant.logo"
           />
           <image
             src="@/static/QR57a.jpg"
@@ -252,7 +252,7 @@ export default {
           },
         );
 
-        console.log();
+        console.log(this.merchantInfo);
 
         this.$store.commit('SET_MERCHANTINFO', res.data);
       }

+ 47 - 3
src/pages/merchant/store/couponManage.vue

@@ -1,5 +1,21 @@
 <template>
-  <view class="couponManage"> 1111111111 </view>
+  <view class="couponManage">
+    <view class="coupon" v-for="(item, index) in initList" :key="index">
+      <view class="item-left">
+        <view class="f-s-38 name">{{ item.name }}</view>
+        <view class="f-s-28 text-666">到期时间:{{ $u.timeFormat(item.expiration) }}</view>
+      </view>
+      <view class="item-right">
+        <view class="fl-flex fl-justify-center">
+          <view class="f-s-40">{{ item.discount }}</view>
+          <text class="f-s-28 u-m-t-10">折</text>
+        </view>
+        <view class="text-cut-2 u-m-t-10">
+          {{ item.description }}
+        </view>
+      </view>
+    </view>
+  </view>
 </template>
 
 <script>
@@ -12,6 +28,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
       },
+      initList: [],
     };
   },
   created() {
@@ -29,7 +46,11 @@ export default {
         },
       );
       getMerchantCoupon(this.list.merchant.id, { ...result }).then(res => {
-        console.log(res);
+        console.log();
+
+        if (res.code === 'OK') {
+          this.initList = res.data.records;
+        }
       });
     },
   },
@@ -38,6 +59,29 @@ export default {
 
 <style lang="scss" scoped>
 .couponManage {
-  background-color: pink;
+  min-height: 100vh;
+  padding: 20rpx 40rpx;
+  .coupon {
+    border-radius: 10rpx;
+    background-color: #fff;
+    margin-bottom: 20rpx;
+    display: flex;
+    .name {
+      color: #333;
+      margin-bottom: 16rpx;
+    }
+    .item-left {
+      padding: 35rpx;
+      width: 60%;
+    }
+    .item-right {
+      padding: 35rpx;
+      color: #fff;
+      width: 40%;
+      text-align: center;
+      border-radius: 0 10rpx 10rpx 0;
+      background-color: #347caf;
+    }
+  }
 }
 </style>