소스 검색

地区支付

jun 2 주 전
부모
커밋
f7f614ffde
5개의 변경된 파일122개의 추가작업 그리고 30개의 파일을 삭제
  1. 35 1
      pages/car/index.vue
  2. 38 6
      pages/car/order.vue
  3. 34 19
      pages/product/index.vue
  4. 12 1
      utils/checkaccess.js
  5. 3 3
      utils/request.js

+ 35 - 1
pages/car/index.vue

@@ -55,6 +55,9 @@
                       <image class="add_icon" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/add_icon.png" mode=""></image>
                     </button>
                   </view>
+                  <view class="pay_title">
+                    <text class="pay_title_text">{{ item.is_pay?'支付商品':'预约商品' }}</text>
+                  </view>
                 </view>
               </view>
             </SwipeAction>
@@ -75,7 +78,7 @@
       <view class="price_box">
         合计:<text class="price_total">¥{{ priceTotal }}</text>
       </view>
-      <view class="to_order" @click="toOrder()">预约</view>
+      <view class="to_order" @click="toOrder()">{{is_pay?'购买':'预约'}}</view>
     </view>
   </view>
 </template>
@@ -98,6 +101,7 @@ export default {
       //购物车列表
       cartListByGroup: [],
       cartList: [],
+      is_pay: 0,
     };
   },
   onLoad() {
@@ -333,20 +337,42 @@ export default {
     priceHandler() {
       // 总价格
       let priceTotal = 0;
+      let pay_status = false;
+      let reservation_status = false;
       // 循环处理
       for (const index in this.cartListByGroup) {
         this.cartListByGroup[index].products.forEach((item) => {
           if (item.checked) {
             priceTotal = this.$decimal.add(priceTotal, this.$decimal.mul(item.price, item.buy_num));
+            if (item.is_pay == 0) {
+              reservation_status    = true;
+            }
+            if (item.is_pay == 1) {
+              pay_status            = true;
+            }
           }
         });
       }
+      if (pay_status && reservation_status){
+        this.is_pay     = 2;
+      }else if(pay_status){
+        this.is_pay     = 1;
+      }else if(reservation_status){
+        this.is_pay     = 0;
+      }else {
+        this.is_pay     = 0;
+      }
+      console.log(this.is_pay)
       // 小数点处理
       this.priceTotal = priceTotal.toFixed(2);
     },
     toOrder() {
       // 等待支付的信息
       let waitList = [];
+      if (this.is_pay == 2) {
+        uni.showToast({ icon: "none", title: "混合商品,无法下单" });
+        return;
+      }
       // 循环处理
       for (let index in this.cartListByGroup) {
         // 如果选中的
@@ -575,6 +601,14 @@ export default {
           background: none;
         }
       }
+      .pay_title {
+        float: right;
+        color: red;
+        overflow: hidden;
+        font-size: 24rpx;
+        margin-top: 40rpx;
+        text-align: center;
+      }
     }
   }
 }

+ 38 - 6
pages/car/order.vue

@@ -86,7 +86,7 @@
         合计:
         <text class="price_total">¥{{ priceTotal }}</text>
       </view>
-      <button class="to_order" @click="createOrder()" data-eventsync="true">立即支付</button>
+      <button class="to_order" @click="createOrder()" data-eventsync="true">{{is_pay?'立即支付':'立即预约'}}</button>
     </view>
     <uni-popup ref="popup" type="bottom" class="popup" background-color="#FFFFFF" @touchmove.stop.prevent="() => {}">
       <view class="coupon_list">
@@ -196,6 +196,7 @@ export default {
         contact_addr: "",
         is_default: 0,
       },
+      is_pay: 0,
     };
   },
   onLoad(param) {
@@ -332,9 +333,17 @@ export default {
     priceHandler() {
       // 总价格
       let priceTotal = 0;
+      let pay_status = false;
+      let reservation_status = false;
       // 循环处理
       for (let index in this.cartList) {
         priceTotal = this.$decimal.add(priceTotal, this.$decimal.mul(this.cartList[index].price, this.cartList[index].buy_num));
+        if (this.cartList[index].is_pay == 0) {
+          reservation_status    = true;
+        }
+        if (this.cartList[index].is_pay == 1) {
+          pay_status            = true;
+        }
       }
       // 扣减数据
       priceTotal = this.$decimal.sub(priceTotal, this.rebatePrice);
@@ -342,6 +351,13 @@ export default {
       priceTotal = this.$decimal.sub(priceTotal, this.discount);
       // 小数点保留
       this.priceTotal = priceTotal.toFixed(2);
+      if (pay_status && reservation_status){
+        this.is_pay     = 2;
+      }else if(pay_status){
+        this.is_pay     = 1;
+      }else if(reservation_status){
+        this.is_pay     = 0;
+      }
     },
     // 创建订单
     createOrder() {
@@ -358,6 +374,7 @@ export default {
             product_id: this.cartList[index].product_id,
             buy_num: this.cartList[index].buy_num,
             product_skuid: this.cartList[index].skuid,
+            shop_cart_id: this.cartList[index].id,
           });
         }
       }
@@ -376,6 +393,13 @@ export default {
         });
         return;
       }
+      if (this.is_pay == 2) {
+        uni.showToast({
+          title: "混合产品,无法下单",
+          icon: "none",
+        });
+        return;
+      }
       //需要下单的产品信息参数传给OrederCompletion页面
       let productInfo = [];
       for (let index in this.cartList) {
@@ -404,17 +428,25 @@ export default {
             custom_coupon_id: this.customCoupon,
             is_cart: 1,
             addr_id: this.checkedAddr.id,
+            is_pay: this.is_pay,
           },
           "post"
         )
         .then((re) => {
           // 判断结果
           if (re.code == "success") {
-            // 跳转到支付确认页面
-            let orderInfo = re.data;
-            orderInfo = JSON.stringify(orderInfo);
-            let params = encodeURIComponent(orderInfo);
-            uni.navigateTo({ url: `/pages/orders/confirm?params=${params}` });
+            if (this.is_pay){
+              // 跳转到支付确认页面
+              let orderInfo = re.data;
+              orderInfo = JSON.stringify(orderInfo);
+              let params = encodeURIComponent(orderInfo);
+              uni.navigateTo({ url: `/pages/orders/confirm?params=${params}` });
+            }else {
+              // 跳转到报单完成页面
+              uni.navigateTo({
+                url: `/pages/orders/completion?params=${encodedArray}`,
+              });
+            }
             return;
           } else {
             uni.showModal({

+ 34 - 19
pages/product/index.vue

@@ -101,7 +101,7 @@
       <navigator url="/pages/car/index" open-type="switchTab" class="to_car">
         <image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/car.png" class="car_icon"></image>
       </navigator>
-      <button class="show_order" v-if="!productInfo.hide_orderbtn" data-eventsync="true" @click="showSpecPopup(1)">立即购买</button>
+      <button class="show_order" v-if="!productInfo.hide_orderbtn" data-eventsync="true" @click="showSpecPopup(1)">{{is_pay?'立即购买':'立即预约'}}</button>
       <button :class="productInfo.hide_orderbtn?'show_car hide_orderbtn ':'show_car'"  data-eventsync="true" @click="showSpecPopup(2)">加入购物车</button>
     </view>
     <view class="to_bottom"> --- 到底了 --- </view>
@@ -170,10 +170,10 @@
         </view>
         <view class="order_price" v-if="specBtnType == 1 || specBtnType == 3">合计: ¥{{ priceTotal }}</view>
         <view class="order_btn">
-          <button class="to_order" @click="createOrder()" v-if="specBtnType == 1" data-eventsync="true">购买</button>
+          <button class="to_order" @click="createOrder()" v-if="specBtnType == 1" data-eventsync="true">{{is_pay?'购买':'预约'}}</button>
           <button class="to_car" @click="createCart()" v-if="specBtnType == 2" data-eventsync="true">加入购物车</button>
-          <button class="to_order" @click="createOrder()" v-if="specBtnType == 3" data-eventsync="true">拼团购买</button>
-          <button class="to_order" @click="createOrder()" v-if="specBtnType == 4" data-eventsync="true">{{ productInfo.regiment_title }}购买</button>
+          <button class="to_order" @click="createOrder()" v-if="specBtnType == 3" data-eventsync="true">{{is_pay?'拼团购买':'拼团预约'}}</button>
+          <button class="to_order" @click="createOrder()" v-if="specBtnType == 4" data-eventsync="true">{{ productInfo.regiment_title }}{{is_pay?'购买':'预约'}}</button>
         </view>
       </view>
     </uni-popup>
@@ -332,8 +332,6 @@ export default {
       priceTotal: "0.00",
       // 优惠券列表
       couponList: [],
-      // 总价
-      priceTotal: "0.00",
       // 优惠券使用
       couponUsed: "去使用 >",
       // 扣减金额
@@ -367,7 +365,7 @@ export default {
       sku_id: 0,
       sku_thumb: "",
       regiment_id: 0,
-      specBtnType: 0,
+      is_pay: 0,
     };
   },
   onLoad(param) {
@@ -441,6 +439,7 @@ export default {
           }
 		  //设置默认sku
 		  this.sku_id = 0;
+		  this.is_pay = this.productInfo.is_pay;
 		  // 显示图片
 		  this.sku_thumb = this.productInfo.thumb;
 		  // 如果只有一个SKU,默认选择一个
@@ -689,6 +688,7 @@ export default {
               btn_type: this.specBtnType,
               regiment_id: this.regiment_id,
               regiment_active_id: this.productInfo.regiment_active_id,
+              is_pay: this.is_pay,
             },
             "post"
           )
@@ -699,12 +699,19 @@ export default {
               this.productInfo.stock = this.productInfo.stock - this.quantity;
               // 关闭弹窗
               this.$refs.specPopup.close();
-              //订单详情
-              let orderInfo = re.data;
-              orderInfo = JSON.stringify(orderInfo)
-              let params = encodeURIComponent(orderInfo);
-              // 跳转到确认支付页面
-              uni.navigateTo({url:`/pages/orders/confirm?params=${params}`});
+              if (this.is_pay){
+                //订单详情
+                let orderInfo = re.data;
+                orderInfo = JSON.stringify(orderInfo)
+                let params = encodeURIComponent(orderInfo);
+                // 跳转到确认支付页面
+                uni.navigateTo({url:`/pages/orders/confirm?params=${params}`});
+              }else {
+                // 跳转到报单完成页面
+                uni.navigateTo({
+                  url: `/pages/orders/completion?params=${encodedArray}`,
+                });
+              }
             } else {
               uni.showModal({
                 title: re.msg,
@@ -721,6 +728,7 @@ export default {
               product_list: productList,
               custom_coupon_id: this.customCoupon,
               addr_id: this.checkedAddr.id,
+              is_pay: this.is_pay,
             },
             "post"
           )
@@ -731,12 +739,19 @@ export default {
               this.productInfo.stock = this.productInfo.stock - this.quantity;
               // 关闭弹窗
               this.$refs.specPopup.close();
-              //订单详情
-              let orderInfo = re.data;
-              orderInfo = JSON.stringify(orderInfo)
-              let params = encodeURIComponent(orderInfo);
-              // 跳转到确认支付页面
-              uni.navigateTo({url:`/pages/orders/confirm?params=${params}`});
+              if (this.is_pay){
+                //订单详情
+                let orderInfo = re.data;
+                orderInfo = JSON.stringify(orderInfo)
+                let params = encodeURIComponent(orderInfo);
+                // 跳转到确认支付页面
+                uni.navigateTo({url:`/pages/orders/confirm?params=${params}`});
+              }else {
+                // 跳转到报单完成页面
+                uni.navigateTo({
+                  url: `/pages/orders/completion?params=${encodedArray}`,
+                });
+              }
             } else {
               uni.showModal({
                 title: re.msg,

+ 12 - 1
utils/checkaccess.js

@@ -138,7 +138,17 @@ const getHasFollow = () => {
   if (!userInfo) return false;
   return userInfo.have_follow == 1;
 };
-
+// 检查城市ID
+const isPay = () => {
+  // 获取登录标识
+  let userInfo = uni.getStorageSync("userInfo");
+  // 如果不存在的话
+  if (!userInfo) return 0;
+  // 资质ID不存在的话
+  if (!userInfo.is_pay) return 0;
+  // 登录成功
+  return 1;
+};
 export default {
   checkLogin: checkLogin,
   alterLogin: alterLogin,
@@ -149,4 +159,5 @@ export default {
   getCity: getCity,
   isManager: isManager,
   getHasFollow: getHasFollow,
+  isPay: isPay,
 };

+ 3 - 3
utils/request.js

@@ -1,9 +1,9 @@
 // 请求域名
-var domain = 'https://kailin.dfwy.tech/'
-//var domain = 'http://kailin.test/'
+//var domain = 'https://kailin.dfwy.tech/'
+var domain = 'http://kailin.test/'
 // #ifdef MP-WEIXIN
 // 'http://127.0.0.1:8000/';
-domain = uni.getAccountInfoSync().miniProgram.envVersion == 'release' ? 'https://mall.findit.ltd/' : 'https://kailin.dfwy.tech/';
+//domain = uni.getAccountInfoSync().miniProgram.envVersion == 'release' ? 'https://mall.findit.ltd/' : 'https://kailin.dfwy.tech/';
 // #endif
 
 // 发送网络请求的函数