Leo vor 3 Jahren
Ursprung
Commit
c76f169f38

+ 1 - 1
src/components/coupon/coupon.vue

@@ -37,7 +37,7 @@
         <text class="coupon-desc">{{ coupon.date || coupon.name }}</text>
         <button
           class="btn"
-          v-if="coupon.is_use === 1"
+          v-if="coupon.is_use !== 1"
           @click.stop="handleUseClick"
         >
           立即使用

+ 9 - 4
src/components/vip-card/vip-card.vue

@@ -7,18 +7,17 @@
     }"
   >
     <view class="card-title">VIP会员</view>
-    <view class="card-desc">开通VIP会员专享权益</view>
+    <view class="card-desc" v-if="!isVip">开通VIP会员专享权益</view>
     <view class="card-status">
-      <template v-if="userInfo && userInfo.type === '1'">已开通</template>
       <button
         class="card-btn"
-        v-else-if="userInfo && userInfo.phone"
+        v-if="userInfo && userInfo.phone && !isVip"
         @click="handlePay"
       >
         立即开通
       </button>
       <button
-        v-else
+        v-else-if="!(userInfo && userInfo.phone)"
         class="card-btn"
         open-type="getPhoneNumber"
         @getphonenumber="handlePhoneLogin"
@@ -58,6 +57,12 @@ export default {
     return {};
   },
 
+  computed: {
+    isVip() {
+      return this.userInfo && this.userInfo.type === "1";
+    },
+  },
+
   created() {
     console.log(this.userInfo);
   },

+ 15 - 0
src/lib/api/other.js

@@ -0,0 +1,15 @@
+import request from "../utils/request";
+
+/**
+ * 商务合作
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=1e097903-604b-4377-84f0-0df588e292da)
+ */
+export const getContact = () => request.get("/weapp/contact");
+
+/**
+ * 填写BD
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=978abd67-5a03-4a03-83ea-0dbf4270f486)
+ */
+export const postBd = (data) => request.post("/weapp/addBd", data);

+ 7 - 0
src/pages.json

@@ -67,6 +67,13 @@
         "enablePullDownRefresh": false
       }
     },
+    {
+      "path": "pages/my/edit",
+      "style": {
+        "navigationBarTitleText": "填写邀请人",
+        "enablePullDownRefresh": false
+      }
+    },
     {
       "path": "pages/help/help",
       "style": {

+ 5 - 1
src/pages/activity/detail.vue

@@ -20,7 +20,11 @@
         :src="detail.intro_img"
         mode="widthFix"
       ></image>
-      <view v-else-if="detail.intro" class="desc" v-html="detail.intro" />
+      <view
+        v-else-if="detail && detail.intro"
+        class="desc"
+        v-html="detail.intro"
+      />
     </view>
     <view class="act-footer" v-if="detail && detail.is_attend === 1">
       <button v-if="detail.status === 0" class="btn btn-gray">未开始</button>

+ 30 - 8
src/pages/help/contact.vue

@@ -1,25 +1,44 @@
 <template>
   <view class="content">
-    <view class="p">联系人:</view>
-    <view class="p">邮箱:</view>
-    <view class="p">电话:</view>
+    <view class="p"
+      >联系人:<text :user-select="true">{{ name }}</text></view
+    >
+    <view class="p"
+      >邮箱:<text :user-select="true">{{ email }}</text></view
+    >
+    <view class="p"
+      >电话:<text :user-select="true">{{ phone }}</text></view
+    >
   </view>
 </template>
 
 <script>
+import { getContact } from "@/lib/api/other";
+
 export default {
   name: "HelpContact",
   data() {
-    return {};
+    return {
+      phone: "",
+      name: "",
+      email: "",
+    };
+  },
+  onLoad() {
+    this.getContact();
+  },
+  methods: {
+    async getContact() {
+      const res = await getContact();
+      this.phone = res.data.phone;
+      this.name = res.data.name;
+      this.email = res.data.email;
+    },
   },
-  methods: {},
 };
 </script>
 
 <style>
-.content {
-}
-
 .p {
   color: #666;
   font-size: 28rpx;
@@ -27,4 +46,7 @@ export default {
   text-indent: 22px;
   margin: 16rpx 32rpx;
 }
+.p text {
+  text-indent: 0;
+}
 </style>

+ 219 - 0
src/pages/my/edit.vue

@@ -0,0 +1,219 @@
+<template>
+  <view class="page">
+    <form @submit.prevent="handleSubmit">
+      <view class="form-item">
+        <input
+          v-model="text"
+          type="text"
+          class="form-input"
+          placeholder="请填写邀请人"
+        />
+      </view>
+      <button
+        form-type="submit"
+        :class="[
+          'btn btn-lg btn-block form-btn w-full',
+          {
+            'btn-disabled': disabled,
+          },
+        ]"
+      >
+        确定
+      </button>
+    </form>
+  </view>
+</template>
+
+<script>
+import login from "@/lib/utils/login";
+import { getUserInfo } from "@/lib/api/user";
+import { postBd } from "@/lib/api/other";
+
+export default {
+  name: "PageMyEdit",
+  data() {
+    return {
+      userInfo: {},
+      text: "",
+    };
+  },
+  computed: {
+    disabled() {
+      return !this.text.trim();
+    },
+  },
+  async onShow() {
+    this.userInfo = await login.getUserInfo();
+    this.getUserInfo();
+  },
+  methods: {
+    //获取个人信息
+    getUserInfo() {
+      getUserInfo()
+        .then((data) => {
+          this.userInfo = { ...this.userInfo, ...data.data };
+          login.setUserInfo(this.userInfo);
+        })
+        .catch((e) => {
+          console.error(e);
+        });
+    },
+    async handleSubmit() {
+      const res = await postBd({ bd: this.text });
+      if (res.errno === 10000) {
+        uni.showToast({
+          icon: "none",
+          title: "提交成功",
+        });
+        setTimeout(() => {
+          uni.navigateBack();
+        }, 2000);
+      } else {
+        uni.showToast({
+          icon: "none",
+          title: res.errmsg,
+        });
+      }
+    },
+  },
+};
+</script>
+
+<style lang="scss">
+.page {
+  padding: 40rpx;
+  box-sizing: border-box;
+}
+
+.btn {
+  padding: 0 8rpx;
+  position: relative;
+  height: 64rpx;
+  background-color: #ff6600;
+  border-radius: 999px;
+  overflow: hidden;
+  color: #ffffff;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  font-size: 24rpx;
+  font-weight: 400;
+  padding: 0 40rpx;
+  min-width: 152rpx;
+  user-select: none;
+  box-sizing: border-box;
+
+  &::after {
+    display: none;
+  }
+
+  @media (hover: hover) {
+    &:not(.skeleton):hover {
+      background-color: #ff7700;
+    }
+  }
+
+  &:not(.skeleton):active {
+    background-color: #ff5500;
+  }
+
+  &.btn-disabled,
+  &:disabled {
+    cursor: default;
+    color: #999999;
+    background: #f0f0f0;
+
+    &:hover,
+    &:active {
+      background: #f0f0f0;
+    }
+  }
+
+  &.btn-outlined {
+    width: 168rpx;
+    height: 64rpx;
+    border: 2rpx solid #ff5005;
+    background: transparent;
+    font-size: 28rpx;
+    color: #ff5c00;
+
+    @media (hover: hover) {
+      &:hover {
+        background: rgba(255, 80, 5, 0.1);
+      }
+    }
+
+    &:active {
+      background: rgba(255, 80, 5, 0.2);
+    }
+  }
+
+  &.btn-block {
+    display: block;
+  }
+
+  &.btn-lg {
+    height: 88rpx;
+    font-size: 34rpx;
+    padding: 0 56rpx;
+  }
+}
+
+.form-item {
+  border-bottom: 1px solid #f0f0f0;
+  padding: 16rpx 0;
+  margin-top: 12rpx;
+  display: flex;
+  align-items: center;
+  .form-input {
+    flex: 1;
+    width: 0;
+    height: 64rpx;
+    font-size: 32rpx;
+
+    .input-placeholder {
+      font-size: 32rpx;
+      color: #ccc;
+    }
+  }
+  .form-captcha {
+    width: 146rpx;
+    height: 64rpx;
+  }
+  .form-icon {
+    min-width: 48rpx;
+    height: 100%;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+  .form-icon-clear {
+    width: 32rpx;
+    height: 32rpx;
+    display: block;
+  }
+}
+.form-btn {
+  margin-top: 90rpx;
+}
+.form-switch,
+.form-text {
+  font-size: 26rpx;
+  margin-top: 40rpx;
+  text {
+    color: #ff6600;
+    white-space: nowrap;
+  }
+}
+.form-switch {
+  text-align: right;
+}
+.form-text {
+  text-align: center;
+  display: flex;
+  flex-wrap: wrap;
+  justify-items: center;
+  align-items: center;
+  line-height: 2;
+}
+</style>

+ 27 - 21
src/pages/my/my.vue

@@ -10,8 +10,14 @@
           <text class="user-name">
             {{ userInfo.nickname }}
           </text>
-          <text class="user-id" @click="handleCopyId"
+          <!-- <text class="user-id" @click="handleCopyId"
             >ID: {{ userInfo.show_id }} <text class="copy">复制</text></text
+          > -->
+          <text class="user-id" v-if="userInfo.bd"
+            >邀请人: {{ userInfo.bd }}</text
+          >
+          <navigator v-else class="user-id" url="/pages/my/edit"
+            ><text class="copy">填写邀请人</text></navigator
           >
         </view>
         <!-- <button class="user-btn" @tap="logout">退出登录</button> -->
@@ -37,15 +43,15 @@
         </view>
         <view class="my-balance-item" @click="jump('./coupon')">
           <view class="num">{{
-            userInfo.coupon_count ? userInfo.coupon_count : "0"
+            userInfo.exchange_cnt ? userInfo.exchange_cnt : "0"
           }}</view>
           <view class="label">卡券</view>
         </view>
       </view>
     </view>
     <vip-card :user-info="userInfo" @login="handleLogin" />
-    <!-- <view class="my-main">
-      <view class="my-title">
+    <view class="my-main">
+      <!--   <view class="my-title">
         <text>我的订单</text>
         <view class="my-title-sub" @click="jump('../order/order?tabIndex=1')">
           <text>全部订单</text>
@@ -65,7 +71,7 @@
           <image class="my-icon" :src="item.image"></image>
           {{ item.name }}
         </view>
-      </view>
+      </view> -->
       <view class="my-title">其他功能</view>
       <view class="my-icon-list">
         <view
@@ -82,7 +88,7 @@
           {{ item.name }}
         </view>
       </view>
-    </view> -->
+    </view>
   </view>
 </template>
 
@@ -141,21 +147,21 @@ export default {
         },
       ],
       datas1: [
-        {
-          name: "邀请好友",
-          image: require("@/assets/my/icon-friend.png"),
-          url: "./invite",
-        },
-        {
-          name: "收货地址",
-          image: require("@/assets/my/icon-address.png"),
-          url: "../address/address",
-        },
-        {
-          name: "我的客服",
-          image: require("@/assets/my/icon-service.png"),
-          url: "../help/help_contact",
-        },
+        // {
+        //   name: "邀请好友",
+        //   image: require("@/assets/my/icon-friend.png"),
+        //   url: "./invite",
+        // },
+        // {
+        //   name: "收货地址",
+        //   image: require("@/assets/my/icon-address.png"),
+        //   url: "../address/address",
+        // },
+        // {
+        //   name: "我的客服",
+        //   image: require("@/assets/my/icon-service.png"),
+        //   url: "../help/help_contact",
+        // },
         // {
         //   name: "消息中心",
         //   image: require("@/assets/my/icon-message.png"),