ソースを参照

对接基本完成

谢杰标 2 年 前
コミット
5961e43056

+ 10 - 9
pages2/bank/detail.vue

@@ -208,7 +208,7 @@
         </view>
       </view>
       <view style="display: flex; color: #ffffff; align-items: center">
-        <view class="btn1" @click="addCart">加购物车</view>
+        <view class="btn1" v-if="!disCode" @click="addCart">加购物车</view>
         <view class="btn2" @click="buy">立即购买</view>
       </view>
     </view>
@@ -345,6 +345,9 @@ export default {
         }
       });
       return checkCout;
+    },
+	disCode() {
+      return this.options.distributionCode;
     },
   },
   onLoad(option) {
@@ -375,7 +378,7 @@ export default {
         }
       }
     }
-    option.distributionCode ? this.getFxDetail() : this.getDetail();
+    this.disCode ? this.getFxDetail() : this.getDetail();
     this.goodsBankList();
     this.getIsBuy(); // 判断是否已经购买过该课程
     wx.showShareMenu({
@@ -426,7 +429,7 @@ export default {
       this.$api
         .fxGoodsDetail({
           goodsId: this.id,
-          disCode: this.options.distributionCode,
+          disCode: this.disCode,
         })
         .then((res) => {
           if (res.data.data) {
@@ -549,8 +552,8 @@ export default {
     },
     toConfirmList(id) {
       let str = "?id=" + id;
-      if (this.options.distributionCode) {
-        str += "&distributionCode=" + this.options.distributionCode;
+      if (this.disCode) {
+        str += "&distributionCode=" + this.disCode;
       }
       if (this.options.linkCode) {
         str += "&linkCode=" + this.options.linkCode;
@@ -608,7 +611,6 @@ export default {
       this.$api
         .addCart({
           goodsId: goodsId,
-          distributionCode: this.options.distributionCode,
         })
         .then((res) => {
           if (res.data.code == 200) {
@@ -624,11 +626,10 @@ export default {
     getSpecDetail() {
       let data = {};
       let url = `/app/common/spec/${this.detail.specTemplateId}`;
-      let { distributionCode } = this.options;
-      if (distributionCode) {
+      if (this.disCode) {
         url = "/app/common/distribution/spec";
         data = {
-          disCode: distributionCode,
+          disCode: this.disCode,
           specTemplateId: this.detail.specTemplateId,
         };
       }

+ 22 - 7
pages2/order/confirm_list.vue

@@ -260,8 +260,8 @@ export default {
     if (option.fromCart) {
       this.fromCart = option.fromCart;
     }
-
-    option.distributionCode ? this.getFxDetail(option.distributionCode) : this.getDetail();
+    this.options = option;
+    this.disCode ? this.getFxDetail() : this.getDetail();
   },
   onShow() {
     /* if(this.current === 2 && this.$method.isLogin()){
@@ -452,14 +452,24 @@ export default {
       if (this.isBK == "1") {
         this.$navTo.togo("/pages2/order/confirm_pay", {
           isBK: "1",
-          fromCart: this.fromCart,
+          ...this.addParam(),
         });
       } else {
         this.$navTo.togo("/pages2/order/confirm_pay", {
-          fromCart: this.fromCart,
+          ...this.addParam(),
         });
       }
     },
+    addParam() {
+      let data = { fromCart: this.fromCart };
+      if (this.disCode) {
+        data.distributionCode = this.disCode;
+      }
+      if (this.options.linkCode) {
+        data.linkCode = this.options.linkCode;
+      }
+      return data;
+    },
     getDetail() {
       let self = this;
       this.$api.commonGoodsDetail(this.id).then((res) => {
@@ -469,12 +479,12 @@ export default {
         }
       });
     },
-    getFxDetail(distributionCode) {
+    getFxDetail() {
       let self = this;
       this.$api
         .fxGoodsDetail({
           goodsId: this.id,
-          disCode: distributionCode,
+          disCode: this.disCode,
         })
         .then((res) => {
           if (res.data.code == 200) {
@@ -515,7 +525,12 @@ export default {
     },
   },
   onReachBottom() {},
-  computed: { ...mapGetters(["userInfo"]) },
+  computed: {
+    ...mapGetters(["userInfo"]),
+    disCode() {
+      return this.options.distributionCode;
+    },
+  },
 };
 </script>
 <style>

+ 7 - 1
pages2/order/confirm_pay.vue

@@ -140,12 +140,14 @@ export default {
       hasPaying: false,
       showConfirmButton: false,
       confirmText: "",
+      options: {},
     };
   },
   onPullDownRefresh() {},
   onLoad(option) {
     this.fromCart = option.fromCart;
     this.isBK = option.isBK;
+    this.options = option;
   },
   onShow() {
     // #ifdef H5
@@ -220,15 +222,19 @@ export default {
             item.goodsInputData = goodsInputData;
           }
         }
+        if (this.options.distributionCode) {
+          item.distributionLinkCode = this.options.linkCode;
+          item.distributionCode = this.options.distributionCode;
+        }
       }
       let data = { goodsList: list };
       // 邀请码
       if (this.sac) {
         data["shareActivityCode"] = this.sac;
       }
+
       // #ifdef MP-WEIXIN
       this.$api.placeSmallOrder(data).then((res) => {
-        console.log(res, "res");
         this.orderResult(res);
       });
       // #endif

+ 17 - 14
pages3/course/detail.vue

@@ -287,7 +287,7 @@
           </view>
         </view>
         <view style="display: flex; color: #ffffff; align-items: center">
-          <view class="btn1" @click="addCart()">加购物车</view>
+          <view class="btn1" v-if="!disCode" @click="addCart()">加购物车</view>
           <view class="btn2" @click="buy()">立即购买 </view>
         </view>
       </template>
@@ -482,6 +482,9 @@ export default {
       }
       return this.specAttrPriceList[0].specialGoods;
     },
+    disCode() {
+      return this.options.distributionCode;
+    },
   },
   onLoad(option) {
     if (option.scene) {
@@ -514,7 +517,7 @@ export default {
         }
       }
     }
-    option.distributionCode ? this.getFxDetail() : this.getDetail();
+    this.disCode ? this.getFxDetail() : this.getDetail();
     this.goodsCourseList();
     this.appCommonGoodsCourseModuleFreeExamList();
     // #ifdef MP-WEIXIN
@@ -723,7 +726,6 @@ export default {
       this.$api
         .addCart({
           goodsIds: goodsIds,
-          distributionCode: this.options.distributionCode,
         })
         .then((res) => {
           if (res.data.code == 200) {
@@ -911,7 +913,7 @@ export default {
       this.$api
         .fxGoodsDetail({
           goodsId: this.id,
-          disCode: this.options.distributionCode,
+          disCode: this.disCode,
         })
         .then((res) => {
           if (res.data.code == 200) {
@@ -974,16 +976,18 @@ export default {
       });
     },
     toConfirmList(id) {
-      let str = "?id=" + id;
-      if (this.options.distributionCode) {
-        str += "&distributionCode=" + this.options.distributionCode;
+      uni.navigateTo({
+        url: "/pages2/order/confirm_list?id=" + id + this.addParam(),
+      });
+    },
+    addParam(str = "") {
+      if (this.disCode) {
+        str += "&distributionCode=" + this.disCode;
       }
       if (this.options.linkCode) {
         str += "&linkCode=" + this.options.linkCode;
       }
-      uni.navigateTo({
-        url: "/pages2/order/confirm_list" + str,
-      });
+      return str;
     },
     buy() {
       if (this.$method.isGoLogin()) {
@@ -1047,11 +1051,10 @@ export default {
       this.checkedAttrs = [];
       let data = {};
       let url = `/app/common/spec/${this.detail.specTemplateId}`;
-      let { distributionCode } = this.options;
-      if (distributionCode) {
+      if (this.disCode) {
         url = "/app/common/distribution/spec";
         data = {
-          disCode: distributionCode,
+          disCode: this.disCode,
           specTemplateId: this.detail.specTemplateId,
         };
       }
@@ -1309,7 +1312,7 @@ export default {
             this.$store.commit("setShoppingCartList", {
               shoppingCartList: data,
             });
-            this.$navTo.togo("/pages2/order/confirm_pay");
+            this.$navTo.togo("/pages2/order/confirm_pay" + this.addParam("?"));
           }
         }
         this.closePop();

+ 1 - 9
pages4/shopping/shoppingCart.vue

@@ -35,10 +35,7 @@
                       <view class="goods-msg">
                         <u-checkbox
                           @change="checkboxChange"
-                          :disabled="
-                            item.goodsStatus == 0 ||
-                            item.distributionStatus == 1
-                          "
+                          :disabled="item.goodsStatus == 0"
                           style="width: 100%"
                           v-model="list[index].checked"
                           shape="circle"
@@ -62,11 +59,6 @@
                                 v-if="item.goodsStatus == 0"
                                 >该商品已下架</view
                               >
-                              <view
-                                class="priceTag"
-                                v-if="item.distributionStatus == 1"
-                                >活动商品已过期</view
-                              >
                             </view>
                           </view>
                         </u-checkbox>