xiaomei 1 жил өмнө
parent
commit
94d73d72e5

+ 48 - 16
src/pagesC/shoppingMallType/index.vue

@@ -128,8 +128,11 @@
               <span>赠茶宝:</span>
               <span>
                 {{
-                  Math.floor((i.min_group_price / 100 - i.coupon_discount / 100) * chabao_ratio * 100) /
-                  100
+                  Math.floor(
+                    (i.min_group_price / 100 - i.coupon_discount / 100) *
+                      chabao_ratio *
+                      100
+                  ) / 100
                 }}
               </span>
             </view>
@@ -339,23 +342,52 @@ export default {
       if (_this.typeObj.type == 1) {
         _this.$refs.popup.open("center");
       } else if (_this.typeObj.type == 2) {
-        post("v1/cashback/taobaoTpwd", {
-          material_id: _this.channel.activity_tags,
-        }).then((res) => {
+        post("v1/user/userinfo").then((res) => {
           if (res.code === 0) {
-            let data = JSON.parse(res.data).tbk_tpwd_create_response.data.password_simple;
+            console.log(res.data.data);
 
-            console.log(data);
-            uniCopy({
-              content: data,
-              success: (res) => {
-                uni.showToast({
-                  title: "商品链接已复制,请转到淘宝APP查看",
-                  icon: "none",
-                  duration: 2000,
+            if (res.data.data.special_id != 0) {
+              post("v1/cashback/taobaoTpwd", {
+                material_id: _this.channel.activity_tags,
+              }).then((res) => {
+                if (res.code === 0) {
+                  let data = JSON.parse(res.data)
+                    .tbk_dg_general_link_convert_response.data.event_url_list
+                    .event_url_list[0].link_info_dto.cps_full_tpwd;
+                  console.log(data);
+                  uniCopy({
+                    content: data,
+                    success: (res) => {
+                      uni.showToast({
+                        title: "商品链接已复制,请转到淘宝APP查看",
+                        icon: "none",
+                        duration: 2000,
+                      });
+                    },
+                    error: (e) => {},
+                  });
+                }
+              });
+            } else {
+              post("v1/cashback/taobaoCode", {}).then((res1) => {
+                console.log(res1);
+                uniCopy({
+                  content: res1.data,
+                  success: (res) => {
+                    uni.showModal({
+                      content: `您还未完成淘宝授权操作,链接已复制到剪贴板,请先转到浏览器粘贴打开完成淘宝授权操作`,
+                      confirmText: "知道了",
+                      showCancel: false,
+                      success(res) {},
+                    });
+                  },
+                  error: (e) => {},
                 });
-              },
-              error: (e) => {},
+              });
+            }
+          } else {
+            uni.reLaunch({
+              url: "/pages/my/index",
             });
           }
         });

+ 63 - 25
src/pagesC/shoppingMallType/p_details.vue

@@ -274,7 +274,7 @@ export default {
 
             this.buttonGroup[1].text =
               "下单省\n¥" +
-              (this.yj_price + this.detail.coupon_discount / 100);
+              Math.floor((this.yj_price + this.detail.coupon_discount / 100)*100)/100;
           } else {
             uni.showModal({
               title: "提示",
@@ -309,9 +309,9 @@ export default {
 
             this.buttonGroup[1].text =
               "下单省\n¥" +
-              (Number(this.detail.reserve_price) -
+              Math.floor((Number(this.detail.reserve_price) -
                 Number(this.goods_price) +
-                Number(this.yj_price));
+                Number(this.yj_price)) *100)/100;
           } else {
             uni.showModal({
               title: "提示",
@@ -359,32 +359,34 @@ export default {
             }
           });
         } else if (this.type == 2) {
-          post("v1/cashback/taobaoUrl", {
-            item_id: _this.detail.input_num_iid,
-          }).then((res) => {
-            if (res.code === 0) {
-              let data = JSON.parse(res.data)
-                .tbk_dg_general_link_convert_response.data.item_url_list
-                .item_url_list[0].link_info_dto.coupon_full_tpwd;
-
-              console.log(data);
-              uniCopy({
-                content: data,
-                success: (res) => {
-                  uni.showToast({
-                    title: "商品链接已复制,请转到淘宝APP查看",
-                    icon: "none",
-                    duration: 2000,
-                  });
-                },
-                error: (e) => {},
+          _this.isOauth()
+        }
+      }
+    },
+    getTaobaoUrl() {
+      let _this = this;
+      post("v1/cashback/taobaoUrl", {
+        item_id: _this.detail.input_num_iid,
+      }).then((res) => {
+        if (res.code === 0) {
+          let data = JSON.parse(res.data)
+            .tbk_dg_general_link_convert_response.data.item_url_list
+            .item_url_list[0].link_info_dto.coupon_full_tpwd;
+          console.log(data);
+          uniCopy({
+            content: data,
+            success: (res) => {
+              uni.showToast({
+                title: "商品链接已复制,请转到淘宝APP查看",
+                icon: "none",
+                duration: 2000,
               });
-            }
+            },
+            error: (e) => {},
           });
         }
-      }
+      });
     },
-
     login(invite) {
       let that = this;
       // #ifdef  MP-WEIXIN
@@ -415,6 +417,42 @@ export default {
     async getuserInfo() {
       this.userinfo = await uni.userfun();
     },
+    isOauth() {
+      let _this = this;
+      post("v1/user/userinfo").then((res) => {
+          if (res.code === 0) {
+            console.log(res.data.data);
+            
+              if (res.data.data.special_id != 0) {
+                _this.getTaobaoUrl()
+              } else {
+                post("v1/cashback/taobaoCode", {}).then(res1 => {
+                  console.log(res1);
+                  uniCopy({
+                    content: res1.data,
+                    success: (res) => {
+                      uni.showModal({
+                          content: `您还未完成淘宝授权操作,链接已复制到剪贴板,请先转到浏览器粘贴打开完成淘宝授权操作`,
+                          confirmText: "知道了",
+                          showCancel: false,
+                          success(res) {
+                            
+                          },
+                      });
+                    },
+                    error: (e) => {},
+                  });
+                  
+                })
+              }
+          } else {
+            uni.reLaunch({
+                url:'/pages/my/index'
+            })
+          }
+      });
+      
+    }
   },
   onShareAppMessage() {
     // let userinfo = uni.getStorageSync("userinfo");