Quellcode durchsuchen

feat:解除绑定弹窗

xyh8905170 vor 2 Jahren
Ursprung
Commit
2e7f7aecad
3 geänderte Dateien mit 36 neuen und 23 gelöschten Zeilen
  1. 8 3
      myPages/familyCard/index.vue
  2. 27 19
      myPages/familyCard/unbindFamilyCard/unbindFamilyCard.vue
  3. 1 1
      pages.json

+ 8 - 3
myPages/familyCard/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="box">
-    <text style="margin-bottom: 24rpx">我收到的亲情卡</text>
+    <text v-if="gotList.length>0" style="margin-bottom: 24rpx">我收到的亲情卡</text>
 
     <view class="getCard Card" v-for="item in gotList" @click="jumpToDetail(item)">
       <view style="display: flex;align-items: center">
@@ -13,7 +13,7 @@
       </view>
     </view>
 
-    <view style="display: flex;justify-content:space-between;margin: 32rpx 0;">
+    <view  style="display: flex;justify-content:space-between;margin: 32rpx 0;">
       <text>我赠送的亲情卡</text>
       <view style="color: #FFAF36;transform: translateY(-10rpx)" @click="jumpToGive">
         <image style="width: 40rpx;height: 40rpx;transform: translateY(10rpx)"
@@ -49,10 +49,15 @@ export default {
   onLoad() {
 
   },
-  onShow(){
+  onShow() {
     this.getGiveList()
     this.getGotList()
   },
+  onPullDownRefresh(){
+    this.getGiveList()
+    this.getGotList()
+    uni.stopPullDownRefresh()
+  },
   methods: {
     jumpToGive() {
       uni.navigateTo({

+ 27 - 19
myPages/familyCard/unbindFamilyCard/unbindFamilyCard.vue

@@ -10,7 +10,7 @@
               <view class="name">已用额度</view>
               <view class="Number" style="font-size: 48rpx">{{ data.amount || 0 }}</view>
             </view>
-            <text style="position: absolute;top:32rpx;right: 32rpx;color:#FFAF36" @click="untieCard">解绑</text>
+            <text style="position: absolute;top:32rpx;right: 32rpx;color:#FFAF36" @click="openUnbindpopup">解绑</text>
           </view>
           <view style="display: flex;justify-content: space-between;margin: 8rpx 0rpx">
             <text>赠送会员编号:</text>
@@ -21,20 +21,25 @@
             <text>{{ data.createTime }}</text>
           </view>
         </view>
-          <text style="margin:24rpx 0;overflow: hidden">使用记录</text>
+        <text style="margin:24rpx 0;overflow: hidden">使用记录</text>
         <view>
-          <mescroll-item ref="MescrollItem" :i="0"  :index="0" :cardId="data.id" :height="scrollViewHeight">
+          <mescroll-item ref="MescrollItem" :i="0" :index="0" :cardId="data.id" :height="scrollViewHeight">
           </mescroll-item>
         </view>
 
       </view>
     </view>
+    <uni-popup ref="unbindpopup" type="dialog">
+      <uni-popup-dialog type="warn" title="警告" content="请确认是否要解除绑定该亲情卡" @confirm="untieCard"
+                        ></uni-popup-dialog>
+    </uni-popup>
   </view>
 </template>
 
 <script>
 
-  import MescrollItem from "./module/mescrollUni-item.vue";
+import MescrollItem from "./module/mescrollUni-item.vue";
+
 export default {
   components: {
     MescrollItem
@@ -42,36 +47,39 @@ export default {
   data() {
     return {
       data: {},
-      scrollViewHeight:'',
+      scrollViewHeight: '',
     };
   },
   onLoad(option) {
     this.data = JSON.parse(option.data)
     console.log(this.data)
     let sysInfo = uni.getSystemInfoSync()
-    this.scrollViewHeight =sysInfo.windowHeight -(sysInfo.windowWidth/750)*500 +'px'
+    this.scrollViewHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 500 + 'px'
     console.log(' this.scrollViewHeight', this.scrollViewHeight)
   },
   onShow() {
   },
   methods: {
+    openUnbindpopup() {
+      this.$refs.unbindpopup.open()
 
+    },
     //解除绑定
     untieCard() {
-        this.$api.untieCard({
-          cardId:this.data.id
-        }).then((res)=>{
-          uni.showToast({
-            icon: 'success',
-            duration: 2000,
-            title:'解绑成功'
+      this.$api.untieCard({
+        cardId: this.data.id
+      }).then((res) => {
+        uni.showToast({
+          icon: 'success',
+          duration: 2000,
+          title: '解绑成功'
+        });
+        setTimeout(() => {
+          uni.redirectTo({
+            url: '/myPages/familyCard/index'
           });
-          setTimeout(()=>{
-            uni.navigateBack({
-              delta: 1
-            })
-          },2000)
-        })
+        }, 2000)
+      })
     },
   },
 };

+ 1 - 1
pages.json

@@ -309,7 +309,7 @@
 					"path": "familyCard/index",
 					"style": {
 						"navigationBarTitleText": "亲情卡",
-						"enablePullDownRefresh": false
+						"enablePullDownRefresh": true
 					}
 				},
 				{