Parcourir la source

1.赠送模块儿添加teaC 2.订单中心页,优化登录

DaMowang il y a 2 ans
Parent
commit
72dd9eaca4

+ 27 - 58
src/pages/account/giveAsPresent.vue

@@ -3,15 +3,10 @@
     <view class="list flex_r flex_ac flex_jb mar_t16">
       <view class="list_name">赠送类型:</view>
       <view class="list_text">
-        <div class="option-i" @click="value = 1">
-          <img src="@/static/img/xuanzhong_icon.png" v-if="value === 1" class="ico" alt="" />
+        <div class="option-i" @click="value = s" v-for="(i,s) in list" :key="s">
+          <img src="@/static/img/xuanzhong_icon.png" v-if="value == s" class="ico" alt="" />
           <img src="@/static/img/weixuanzhong_icon.png" v-else class="ico" alt="" />
-          <span class="txt">茶宝</span>
-        </div>
-        <div class="option-i" @click="value = 0">
-          <img src="@/static/img/xuanzhong_icon.png" v-if="value === 0" class="ico" alt="" />
-          <img src="@/static/img/weixuanzhong_icon.png" v-else class="ico" alt="" />
-          <span class="txt">云宝</span>
+          <span class="txt">{{ i.name }}</span>
         </div>
       </view>
     </view>
@@ -19,10 +14,14 @@
       <view class="list_name">当前云宝:</view>
       <view class="list_text"><text>{{ userinfo.user_money }}</text></view>
     </view>
-    <view class="list flex_r flex_ac flex_jb mar_t16" v-else>
+    <view class="list flex_r flex_ac flex_jb mar_t16" v-else-if="value == 1">
       <view class="list_name">当前茶宝:</view>
       <view class="list_text"><text>{{ userinfo.cha_bao }}</text></view>
     </view>
+    <view class="list flex_r flex_ac flex_jb mar_t16" v-else>
+      <view class="list_name">当前TeaC:</view>
+      <view class="list_text"><text>{{ userinfo.teac }}</text></view>
+    </view>
     <view class="list flex_r flex_ac flex_jb mar_t16">
       <view class="list_name">对方账号:</view>
       <view class="list_text">
@@ -75,80 +74,55 @@ export default {
       if (this.give_num == 0) {
         appEv.errTips("赠送数量不得为0");
         return;
+      } else if (
+        this.give_num > Number(this.userinfo.teac) &&
+        this.value == 2
+      ) {
+        appEv.errTips("赠送数量不得超过teac余额");
+        return;
       } else if (
         this.give_num > Number(this.userinfo.cha_bao) &&
         this.value == 1
       ) {
-        appEv.errTips("赠送数量不得超过茶宝云宝");
+        appEv.errTips("赠送数量不得超过茶宝余额");
         return;
       } else if (
         this.give_num > Number(this.userinfo.user_money) &&
         this.value == 0
       ) {
-        appEv.errTips("赠送数量不得超过云宝");
+        appEv.errTips("赠送数量不得超过云宝余额");
         return;
       } else if (this.id == "") {
         appEv.errTips("请输入赠送账号");
         return;
       } else {
-        let content = "";
-        if (this.value == 0) {
-          content = `你将赠送给${this.id}云宝${
-            this.give_num
-          },扣除手续费后对方将收到${
-            this.$h.Mul(this.give_num, (1 - this.list[this.value].fee))
-          }云宝`;
-        } else {
-          content = `你将赠送给${this.id}茶宝${
-            this.give_num
-          },扣除手续费后对方将收到${
-            this.$h.Mul(this.give_num, (1 - this.list[this.value].fee))
-          }茶宝`;
-        }
+        let it_name = this.list[this.value].name;
+        let content = `你将赠送${it_name}给${this.id},扣除手续费后对方将收到${ this.$h.Mul(this.give_num, (1 - this.list[this.value].fee)) }${it_name}`;
         let that = this
         uni.showModal({
           title: "提示",
           content: content,
           showCancel: true,
           success: function(res) {
-            if (res.confirm) {
-              if (that.value == 0) {
-                that.giveMoney();
-              } else {
-                that.giveIntegral();
-              }
-            } else {}
+            if (res.confirm) that.giveMoney();
           },
         });
       }
     },
-    // 赠送茶宝
-    giveIntegral() {
-      let data = {
-        mobile: this.id,
-        number: this.give_num,
-      };
-      post("v1/my/give", data).then((res) => {
-        if (res.code === 0) {
-          this.give_num = 0;
-          this.id = "";
-          this.getuserInfo();
-          appEv.errTips(res.msg);
-        } else {
-          appEv.errTips(res.msg);
-        }
-      });
-    },
-
+    // 赠送云宝
     giveMoney() {
+        let url = "v1/my/moneyGive"
+        if (this.value == 1) { url = "v1/my/give" }
+        else if (this.value == 2) { url = "v1/my/giveTeac" }
+        else  url = "v1/my/moneyGive"
       let data = {
         mobile: this.id,
         number: this.give_num,
       };
-      post("v1/my/moneyGive", data).then((res) => {
+      post(url, data).then((res) => {
         if (res.code === 0) {
-          this.give_num = 0;
-          this.id = "";
+            this.id = "";
+          this.give_num = "";
           appEv.errTips(res.msg);
           this.getuserInfo();
         } else {
@@ -163,9 +137,6 @@ export default {
 
     OnpickerShow() {
       this.pickerShow = !this.pickerShow;
-    },
-    confirm(da) {
-      this.value = da[0]
     }
   },
 };
@@ -187,7 +158,6 @@ page {
 }
 
 .list_text {
-  flex: 1;
   font-family: "SourceHanSansCN-Bold";
   text-align: right;
 
@@ -215,7 +185,6 @@ page {
 }
 
 .list_name {
-  flex: 1;
   color: #333333;
   font-size: 28rpx;
   font-family: "SourceHanSansCN-Medium";

+ 1 - 0
src/pages/my/index.vue

@@ -226,6 +226,7 @@ export default {
         if (options.invite) {
             app.globalData.agentId = options.invite;
             this.invited = options.invite;
+            uni.setStorageSync("inviteCode", options.invite)
         }
         this.closeAuto(); //关闭实名功能
     },

+ 53 - 4
src/pages/szw-order-list/index.vue

@@ -41,20 +41,22 @@
             </view>
         </view>
         <view class="loading-indicator opacity">{{ loadingTip }}</view>
+        <authorize-module ref="autho" :shopInfo="shopInfo" @authGetTelSuccess="onauthGetTelSuccess" />
     </view>
 </template>
 <script>
 var page = 1;
 var app = getApp();
 var appEv = app.$vm.$options;
-import notGoods from "@/components/not-goods/index";
-import { post } from "@/request/api.js";
 import { ToPayOpre } from "@/utils/reqTools.js";
 var toPayOpre = new ToPayOpre();
+import notGoods from "@/components/not-goods/index";
+import authorizeModule from "@/components/authorize-module/index";
+import { post } from "@/request/api.js";
 export default {
     components: {
         notGoods,
-        // terraceTagbar
+        authorizeModule
     },
     data() {
         return {
@@ -74,15 +76,62 @@ export default {
             userId: "",
             isweixin: "",
             pt: {},
+            shopInfo: {}, // 商铺信息
+            unid: "",
+            token: uni.getStorageSync("token"),
         };
     },
     onLoad(options) {
         this.currentType = options.status ? options.status : 0;
     },
     onShow() {
-        this.loadData();
+        if (!this.token) this.login()
+        else this.loadData();
     },
     methods: {
+        login() {
+            let that = this;
+            // #ifdef  MP-WEIXIN
+            wx.login({
+                success(res) {
+                    if (res.code) {
+                        post("v1/appletLogin", {
+                            code: res.code,
+                            invite: "XHCYGNZM",
+                        }).then((res) => {
+                            if (res.code === 0) {
+                                if (res.data.token) {
+                                    uni.setStorageSync("token", res.data.token);
+                                    that.loadData();
+                                } else {
+                                    that.unid = res.data.unid;
+                                    that.shopInfo = app.globalData.shopInfo;
+                                    that.SoHAuth(); //调取授权弹窗
+                                }
+                            }
+                        });
+                    }
+                },
+            });
+            // #endif
+        },
+        // 获取手机号
+        onauthGetTelSuccess(da) {
+            this.SoHAuth();
+            post("v1/getMobile", {
+                unid: this.unid,
+                ...da.detail,
+            }).then((res) => {
+                if (res.code === 0) {
+                    uni.setStorageSync("token", res.data.token);
+                    this.loadData();
+                }
+            });
+        },
+        SoHAuth() {
+            this.$refs.autho.onSoHAuth();
+        },
+        
         clearData(isclearCat = true, callBack) {
             page = 1;
             this.orderList = [];

+ 10 - 4
src/pagesB/accountDetails/TeaC.vue

@@ -5,7 +5,7 @@
             <view class="list" v-for="(item, index) in list" :key="index">
                 <view class="list_head flex_r flex_ac flex_jb">
                     <view :class="['head_price',item.act == '+' ? 'g_color' : '']">{{item.act}}{{ item.num }}</view>
-                    <view class="head_name">{{ type(item.type) }}</view>
+                    <view class="head_name">{{ type(item.type_id) }}</view>
                 </view>
                 <view class="list_con flex_r flex_ac flex_jb">
                     <view class="list_balance">{{ item.create_time }}</view>
@@ -92,11 +92,17 @@ export default {
             return (va) => {
                 switch (va) {
                     case 0:
-                        return "零售收货发放积分";
+                        return "收货发放TeaC";
                     case 1:
-                        return "批发扣除积分";
+                        return "分享消费发放奖励";
                     case 2:
-                        return "退货积分";
+                        return "转介绍消费发放奖励";
+                    case 3:
+                        return "平台发放TeaC";
+                    case 4:
+                        return "收到赠送TeaC";
+                    case 5:
+                        return "赠送支出TeaC";
                     default:
                         return "";
                 }