Explorar el Código

feat: 增加跳转新活动联通流量充值界面

Damon hace 11 meses
padre
commit
a8401cecc0
Se han modificado 1 ficheros con 131 adiciones y 0 borrados
  1. 131 0
      src/pages/activity/new.vue

+ 131 - 0
src/pages/activity/new.vue

@@ -0,0 +1,131 @@
+<template>
+  <view v-if="pic" class='app-container'>
+    <img :src="pic" />
+    <button class="submit" type="submit" circle @click="getSubmit">立即领取</button>
+
+    <!-- 弹窗 -->
+    <uni-popup ref="popup" type="center" :is-mask-click="false">
+      <view class="popup">
+        <h3>领取成功</h3>
+        <view class="center">{{ content }}</view>
+        <view class="submit-btn">
+          <button type="submit" circle @click="getClose">确定</button>
+<!--          <span>该套餐内容仅可在WIFI/移动数据模式下收听</span>-->
+        </view>
+      </view>
+    </uni-popup>
+  </view>
+</template>
+
+<script>
+import {doDlowActivityExchange} from "@/api/pay";
+export default {
+  data() {
+    return {
+      pic: '',
+      form: {
+        activityId: '',
+        state: ''
+      },
+      // 弹窗内容
+      content: '',
+      // 领取成功
+      isShow: false
+    }
+  },
+  onLoad(e) {
+    this.id = e.id
+    this.name =e.name
+    this.pic = e.pic
+    this.description = e.description
+
+    this.form.activityId=e.id
+    this.form.state=e.state
+  },
+  methods: {
+    // 立即领取
+    getSubmit() {
+      doDlowActivityExchange(this.form).then(res => {
+        console.log(res)
+
+        // this.$refs.popup.open()
+        // this.content = "恭喜获得120G移动数据流量"
+        // this.isShow = true
+        if (res.code === 0) {
+          this.$refs.popup.open()
+          this.content = res.data
+          this.isShow = true
+        } else {
+
+          // console.log(res.data.message)
+          uni.showToast({
+            title: res.message,
+            icon: 'none',
+            mask: true,
+            duration: 2000
+          })
+        }
+      })
+    },
+
+    // 关闭弹窗
+    getClose() {
+      this.$refs.popup.close()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.app-container {
+  padding: 0;
+  overflow: hidden;
+  position: relative;
+}
+
+img {
+  width: 100%;
+  height: 100%;
+  display: block;
+}
+
+.submit {
+  position: absolute;
+  bottom: 20rpx;
+  left: 50%;
+  transform: translate(-50%);
+  width: calc(100% - 120rpx);
+}
+
+.popup {
+  width: 576rpx;
+  height: 600rpx;
+  background: #fff;
+  border-radius: 32rpx;
+  color: #000;
+  font-weight: bold;
+  text-align: center;
+  padding: 48rpx 0;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+  align-items: center;
+
+  .center {
+    font-size: 32rpx;
+  }
+
+  .submit-btn {
+    button {
+      width: 320rpx;
+      height: 80rpx;
+      line-height: 80rpx;
+      font-size: 32rpx;
+    }
+
+    span {
+      font-size: 24rpx;
+    }
+  }
+}
+</style>