Przeglądaj źródła

Merge branch 'test' into branch_qxy_dev

# Conflicts:
#	pages/car/order.vue
#	pages/product/index.vue
钱新宇 2 tygodni temu
rodzic
commit
506c7db0c1
4 zmienionych plików z 306 dodań i 204 usunięć
  1. 35 1
      pages/car/index.vue
  2. 71 40
      pages/car/order.vue
  3. 188 162
      pages/product/index.vue
  4. 12 1
      utils/checkaccess.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;
+      }
     }
   }
 }

+ 71 - 40
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">
@@ -171,14 +171,14 @@ export default {
       promoRebateList: [],
       // 请求参数
       requestParam: {
-        cart_ids: "",
+        cart_ids: '',
       },
       // 总价
-      priceTotal: "0.00",
-      discount: "0.00",
-      reduction: "0.00",
+      priceTotal: '0.00',
+      discount: '0.00',
+      reduction: '0.00',
       // 优惠券使用
-      couponUsed: "去使用 >",
+      couponUsed: '去使用 >',
       // 扣减金额
       rebatePrice: 0.0,
       // 已经选择的优惠券ID
@@ -188,14 +188,15 @@ export default {
       // 已选地址
       checkedAddr: {
         id: 0,
-        contact_name: "",
-        contact_phone: "",
-        contact_province: "",
-        contact_city: "",
-        contact_area: "",
-        contact_addr: "",
+        contact_name: '',
+        contact_phone: '',
+        contact_province: '',
+        contact_city: '',
+        contact_area: '',
+        contact_addr: '',
         is_default: 0,
       },
+      is_pay: 0,
     };
   },
   onLoad(param) {
@@ -203,15 +204,15 @@ export default {
     this.requestParam.cart_ids = param.cart_ids;
     var that = this;
     // 监听地址变动
-    uni.$on("addr_list_change", function (data) {
+    uni.$on('addr_list_change', function (data) {
       // 地址列表
       that.addrList = data.list;
     });
   },
   onShow() {
     // 结果
-    this.$http.request("api/shop_cart/check_list", this.requestParam).then((re) => {
-      if (re.code == "success") {
+    this.$http.request('api/shop_cart/check_list', this.requestParam).then((re) => {
+      if (re.code == 'success') {
         // 赋值
         this.cartList = re.data;
         this.cartListByGroup = this.formatGroupedData(re.data);
@@ -219,8 +220,8 @@ export default {
         this.discount = re.discount;
         this.reduction = re.reduction;
         // 结果
-        this.$http.request("api/custom_coupon/get_checked", this.requestParam).then((re) => {
-          if (re.code == "success") {
+        this.$http.request('api/custom_coupon/get_checked', this.requestParam).then((re) => {
+          if (re.code == 'success') {
             // 赋值
             this.couponList = re.data;
             // 推荐使用的优惠券
@@ -326,15 +327,23 @@ export default {
     // 地址弹出层
     showAddrPopup() {
       // 显示下单弹出层
-      this.$refs.addrPopup.open("bottom");
+      this.$refs.addrPopup.open('bottom');
     },
     // 价格计算
     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,21 +374,29 @@ 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,
           });
         }
       }
       if (productList.length <= 0) {
         uni.showToast({
-          title: "未选择可购买的产品",
-          icon: "none",
+          title: '未选择可购买的产品',
+          icon: 'none',
         });
         return;
       }
       // 地址未填
       if (!this.checkedAddr.id) {
         uni.showToast({
-          title: "请选择收货地址",
-          icon: "none",
+          title: '请选择收货地址',
+          icon: 'none',
+        });
+        return;
+      }
+      if (this.is_pay == 2) {
+        uni.showToast({
+          title: '混合产品,无法下单',
+          icon: 'none',
         });
         return;
       }
@@ -398,30 +422,37 @@ export default {
       // 请求接口
       this.$http
         .request(
-          "api/orders/create",
+          'api/orders/create',
           {
             product_list: productList,
             custom_coupon_id: this.customCoupon,
             is_cart: 1,
             addr_id: this.checkedAddr.id,
+            is_pay: this.is_pay,
           },
-          "post"
+          '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 (re.code == 'success') {
+            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({
-            title: re.msg,
-            showCancel: false,
-			  });
-            
+              title: re.msg,
+              showCancel: false,
+            });
           }
         });
     },
@@ -439,7 +470,7 @@ export default {
         if (index != i) this.couponList[i].checked = 0;
       }
       // 如果未选中,提示可用
-      if (!this.couponList[index].checked) this.couponUsed = "去使用 >";
+      if (!this.couponList[index].checked) this.couponUsed = '去使用 >';
       // 已经选择的优惠券ID
       this.customCoupon = this.couponList[index].checked ? this.couponList[index].id : 0;
       // 计算扣减
@@ -490,7 +521,7 @@ export default {
             // 计算扣减数据
             rebatePrice = this.$decimal.mul(this.couponList[i].rebate, 1);
             // 替换文字
-            this.couponUsed = "¥-" + rebatePrice.toFixed(2);
+            this.couponUsed = '¥-' + rebatePrice.toFixed(2);
           }
           // 折扣
           if (this.couponList[i].rebate_type == 2) {
@@ -499,12 +530,12 @@ export default {
             // -0.1 表示折扣
             rebatePrice = this.$decimal.sub(totalPrice, rebatePrice.mul(0.1));
             // 替换文字
-            this.couponUsed = "¥-" + rebatePrice.toFixed(2);
+            this.couponUsed = '¥-' + rebatePrice.toFixed(2);
           }
           //  赠品
           if (this.couponList[i].rebate_type == 3) {
             // 替换文字
-            this.couponUsed = "送" + (this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name : "");
+            this.couponUsed = '送' + (this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name : '');
           }
           // 小数点保留
           this.rebatePrice = rebatePrice.toFixed(2);
@@ -518,9 +549,9 @@ export default {
     },
     getAddrList() {
       // 判断数据
-      this.$http.request("api/custom_addr/get_list").then((callback) => {
+      this.$http.request('api/custom_addr/get_list').then((callback) => {
         // 获取成功
-        if (callback.code == "success") {
+        if (callback.code == 'success') {
           this.addrList = callback.data;
           // 如果有的话
           if (this.addrList.length) {

+ 188 - 162
pages/product/index.vue

@@ -101,8 +101,12 @@
       <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>
+      <<<<<<< HEAD
       <button class="show_order" v-if="!productInfo.hide_orderbtn" data-eventsync="true" @click="showSpecPopup(1)">立即购买</button>
-      <button :class="productInfo.hide_orderbtn?'show_car hide_orderbtn ':'show_car'"  data-eventsync="true" @click="showSpecPopup(2)">加入购物车</button>
+      =======
+      <button class="show_order" v-if="!productInfo.hide_orderbtn" data-eventsync="true" @click="showSpecPopup(1)">{{ is_pay ? '立即购买' : '立即预约' }}</button>
+      >>>>>>> test
+      <button :class="productInfo.hide_orderbtn ? 'show_car hide_orderbtn ' : 'show_car'" data-eventsync="true" @click="showSpecPopup(2)">加入购物车</button>
     </view>
     <view class="to_bottom"> --- 到底了 --- </view>
     <uni-popup ref="specPopup" :show="true" type="bottom" class="popup" background-color="#FFFFFF" @change="popupChange">
@@ -170,10 +174,17 @@
         </view>
         <view class="order_price" v-if="specBtnType == 1 || specBtnType == 3">合计: ¥{{ priceTotal }}</view>
         <view class="order_btn">
+          <<<<<<< HEAD
           <button class="to_order" @click="createOrder()" v-if="specBtnType == 1" data-eventsync="true">购买</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 == 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">{{ is_pay ? '拼团购买' : '拼团预约' }}</button>
+          <button class="to_order" @click="createOrder()" v-if="specBtnType == 4" data-eventsync="true">{{ productInfo.regiment_title }}{{ is_pay ? '购买' : '预约' }}</button>
+          >>>>>>> test
         </view>
       </view>
     </uni-popup>
@@ -199,9 +210,9 @@
               <view class="coupon_name" v-if="item.rebate_type == 3">赠品券</view>
             </view>
             <view class="product_scope">
-              <text class="" v-if="item.type_id == 1">{{ item.is_scope ? "当前商品可用" : "当前商品不可用" }}</text>
+              <text class="" v-if="item.type_id == 1">{{ item.is_scope ? '当前商品可用' : '当前商品不可用' }}</text>
               <text class="" v-if="item.type_id == 2">全场可用</text>
-              <text class="" v-if="item.type_id == 3">{{ item.is_scope ? "当前商品可用" : "当前商品不可用" }}</text>
+              <text class="" v-if="item.type_id == 3">{{ item.is_scope ? '当前商品可用' : '当前商品不可用' }}</text>
               <view class="check_label">
                 <view class="isstd" v-if="!item.is_std">未达标</view>
                 <image
@@ -294,27 +305,27 @@ export default {
       show: false, // 使用Popup组件时,阻止禁止滚动穿透
       productInfo: {
         id: 0,
-        name: "",
-        price: "0.00",
-        market_price: "0.00",
-		hide_orderbtn:0,
-        spec: "",
+        name: '',
+        price: '0.00',
+        market_price: '0.00',
+        hide_orderbtn: 0,
+        spec: '',
         stock: 0,
-        thumb: "",
-        poster: "",
-        description: "",
-        regiment_title: "",
-        promo_title: "",
+        thumb: '',
+        poster: '',
+        description: '',
+        regiment_title: '',
+        promo_title: '',
         automatic_info: {
-          end_time: "",
+          end_time: '',
         },
         regiment_active: [],
         business_info: {
-          name: "",
-          logopic: "",
-          desc: "",
+          name: '',
+          logopic: '',
+          desc: '',
         },
-        regiment_price: "0.00",
+        regiment_price: '0.00',
         regiment_quota: 0,
         regiment_list: [],
         product_attr: [],
@@ -329,13 +340,11 @@ export default {
       // 数量
       quantity: 1,
       // 总价
-      priceTotal: "0.00",
+      priceTotal: '0.00',
       // 优惠券列表
       couponList: [],
-      // 总价
-      priceTotal: "0.00",
       // 优惠券使用
-      couponUsed: "去使用 >",
+      couponUsed: '去使用 >',
       // 扣减金额
       rebatePrice: 0.0,
       // 已经选择的优惠券ID
@@ -347,27 +356,27 @@ export default {
       // 已选地址
       checkedAddr: {
         id: 0,
-        contact_name: "",
-        contact_shop: "",
-        contact_phone: "",
-        contact_province: "",
-        contact_city: "",
-        contact_area: "",
-        contact_addr: "",
+        contact_name: '',
+        contact_shop: '',
+        contact_phone: '',
+        contact_province: '',
+        contact_city: '',
+        contact_area: '',
+        contact_addr: '',
         is_default: 0,
         show_type: 0,
       },
       // 客服二维码
-      followQrcode: "",
+      followQrcode: '',
       // 二维码链接
-      follow_linkurl: "",
+      follow_linkurl: '',
       // 是否登录状态
       isShowPrice: false,
       // 选择的skuid
       sku_id: 0,
-      sku_thumb: "",
+      sku_thumb: '',
       regiment_id: 0,
-      specBtnType: 0,
+      is_pay: 0,
     };
   },
   onLoad(param) {
@@ -382,7 +391,7 @@ export default {
     }
     var that = this;
     // 监听地址变动
-    uni.$on("addr_list_change", function (data) {
+    uni.$on('addr_list_change', function (data) {
       // 地址列表
       that.addrList = data.list;
     });
@@ -390,22 +399,22 @@ export default {
     //分享按钮
     uni.showShareMenu({
       withShareTicket: true,
-      menus: ["shareAppMessage", "shareTimeline"],
+      menus: ['shareAppMessage', 'shareTimeline'],
     });
     // #endif
   },
   onShareAppMessage(obj) {
     return {
       title: `999智控终端平台\n${this.productInfo.name}`,
-      path: "/pages/product/index?product_id=" + this.productInfo.id,
+      path: '/pages/product/index?product_id=' + this.productInfo.id,
       promise: new Promise((resolve, reject) => {
-        this.$http.request("api/share_message/get_item", { item_id: this.productInfo.id, pages: "/pages/product/index" }).then((callback) => {
-          console.log(callback, "api/share_message/get_item");
+        this.$http.request('api/share_message/get_item', { item_id: this.productInfo.id, pages: '/pages/product/index' }).then((callback) => {
+          console.log(callback, 'api/share_message/get_item');
           let obj = {
-            title: callback.data?.title == "" ? `999智控终端平台\n${this.productInfo.name}` : callback.data.title,
-            path: "/pages/product/index?product_id=" + this.productInfo.id,
+            title: callback.data?.title == '' ? `999智控终端平台\n${this.productInfo.name}` : callback.data.title,
+            path: '/pages/product/index?product_id=' + this.productInfo.id,
           };
-          if (callback.data?.image_url !== "") {
+          if (callback.data?.image_url !== '') {
             obj.imageUrl = callback.data.image_url;
           }
           resolve(obj);
@@ -419,39 +428,40 @@ export default {
     // 如果有添加二维码的话,获取客户信息
     if (this.$checkAccess.getFollowQrcode()) {
       // 判断数据
-      this.$http.request("api/custom/get_info").then((callback) => {
-        if (callback.code == "success") {
-          if (!callback.data.userpic) callback.data.userpic = "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png";
+      this.$http.request('api/custom/get_info').then((callback) => {
+        if (callback.code == 'success') {
+          if (!callback.data.userpic) callback.data.userpic = 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png';
           // 存储登录标识
-          uni.setStorageSync("userInfo", callback.data);
+          uni.setStorageSync('userInfo', callback.data);
         }
       });
     }
     // 如果存在产品ID的话
     if (this.requestParam.id > 0) {
       // 请求详情
-      this.$http.request("api/product/get_detail", this.requestParam).then((re) => {
+      this.$http.request('api/product/get_detail', this.requestParam).then((re) => {
         // 成功渲染数据
-        if (re.code == "success") {
+        if (re.code == 'success') {
           // 刷新数据
           this.productInfo = re.data;
-		  // 
+          //
           if (this.productInfo.automatic_info.id) {
             this.regiment_id = this.productInfo.automatic_info.id;
           }
-		  //设置默认sku
-		  this.sku_id = 0;
-		  // 显示图片
-		  this.sku_thumb = this.productInfo.thumb;
-		  // 如果只有一个SKU,默认选择一个
-          if ( this.productInfo.product_attr.length == 1) {
-			// 设置对应的属性已经选中
-            if ( this.productInfo.product_attr[0].attr_list.length == 1 ) {
-				this.attrChange(0,0);
+          //设置默认sku
+          this.sku_id = 0;
+          this.is_pay = this.productInfo.is_pay;
+          // 显示图片
+          this.sku_thumb = this.productInfo.thumb;
+          // 如果只有一个SKU,默认选择一个
+          if (this.productInfo.product_attr.length == 1) {
+            // 设置对应的属性已经选中
+            if (this.productInfo.product_attr[0].attr_list.length == 1) {
+              this.attrChange(0, 0);
             }
           }
         } else {
-          if (re.code != "no_login") {
+          if (re.code != 'no_login') {
             uni.showModal({
               content: re.msg,
               showCancel: false,
@@ -486,7 +496,7 @@ export default {
     // 地址弹出层
     showAddrPopup() {
       // 显示下单弹出层
-      this.$refs.addrPopup.open("bottom");
+      this.$refs.addrPopup.open('bottom');
     },
     // 规格弹出层
     showSpecPopup(type, regiment_id = 0) {
@@ -500,7 +510,7 @@ export default {
       // 显示类型,1预约,2购物车,3拼团
       this.specBtnType = type;
       // 恢复优惠券使用按钮
-      this.couponUsed = "去使用 >";
+      this.couponUsed = '去使用 >';
       // 恢复扣减金额
       this.rebatePrice = 0.0;
       // 选择优惠券重置
@@ -508,28 +518,28 @@ export default {
       // 计算价格
       this.priceHandler();
       // 显示下单弹出层
-      this.$refs.specPopup.open("bottom");
-	  // 如果非团购的话,查询优惠券
-	  if( type == 3 || type == 4 ){
-		  // 选择优惠券重置
-		  this.couponList = [];
-		  // 已经选择的优惠券ID
-		  this.customCoupon = 0;
-		  // 计算扣减
-		  this.couponRebate();
-		  // 计算价格
-		  this.priceHandler();
-	  }else{
-		  // 结果
-		  this.$http.request("api/custom_coupon/get_checked", this.requestParam).then((re) => {
-		    if (re.code == "success") {
-		      // 赋值
-		      this.couponList = re.data;
-		      // 优惠券是否可用
-		      this.checkCoupon();
-		    }
-		  });
-	  }
+      this.$refs.specPopup.open('bottom');
+      // 如果非团购的话,查询优惠券
+      if (type == 3 || type == 4) {
+        // 选择优惠券重置
+        this.couponList = [];
+        // 已经选择的优惠券ID
+        this.customCoupon = 0;
+        // 计算扣减
+        this.couponRebate();
+        // 计算价格
+        this.priceHandler();
+      } else {
+        // 结果
+        this.$http.request('api/custom_coupon/get_checked', this.requestParam).then((re) => {
+          if (re.code == 'success') {
+            // 赋值
+            this.couponList = re.data;
+            // 优惠券是否可用
+            this.checkCoupon();
+          }
+        });
+      }
       // 地址列表
       this.getAddrList();
       //只有一组sku时是否下架
@@ -539,11 +549,11 @@ export default {
     },
     // 拼团列表弹出层
     openRegiment() {
-      this.$refs.regiment.open("bottom");
+      this.$refs.regiment.open('bottom');
     },
     // 优惠券弹出层
     openCoupon() {
-      this.$refs.couponPopup.open("bottom");
+      this.$refs.couponPopup.open('bottom');
     },
     // 数量调整
     changeQuantity(number) {
@@ -556,23 +566,23 @@ export default {
       if (this.quantity > this.productInfo.stock) {
         this.quantity = this.productInfo.stock;
         uni.showToast({
-          title: "库存不足",
-          icon: "none",
+          title: '库存不足',
+          icon: 'none',
         });
       }
       if ((this.specBtnType === 3 || this.specBtnType == 4) && this.quantity > this.productInfo.regiment_quota) {
         this.quantity = this.productInfo.regiment_quota;
         uni.showToast({
-          title: "拼团限购" + this.productInfo.regiment_quota + "份",
-          icon: "none",
+          title: '拼团限购' + this.productInfo.regiment_quota + '份',
+          icon: 'none',
         });
       }
       // 如果小于1.设置为1
       if (this.quantity < 1) {
         this.quantity = 1;
         uni.showToast({
-          title: "数量不可以小于0",
-          icon: "none",
+          title: '数量不可以小于0',
+          icon: 'none',
         });
       }
       // 计算价格
@@ -594,24 +604,24 @@ export default {
           skuname.push(this.productInfo.product_attr[i].spec_name);
         }
         uni.showToast({
-          title: "请选择" + skuname.join(" 与 "),
-          icon: "none",
+          title: '请选择' + skuname.join(' 与 '),
+          icon: 'none',
         });
         return;
       }
       // 下单数量小于0
       if (this.quantity < 1) {
         uni.showToast({
-          title: "至少购买1个",
-          icon: "none",
+          title: '至少购买1个',
+          icon: 'none',
         });
         return;
       }
       // 如果大于库存设置为库存
       if (this.productInfo.stock < 1) {
         uni.showToast({
-          title: "库存不足",
-          icon: "none",
+          title: '库存不足',
+          icon: 'none',
         });
         return;
       }
@@ -619,8 +629,8 @@ export default {
       if (this.productInfo.stock < this.quantity) {
         this.quantity = this.productInfo.stock;
         uni.showToast({
-          title: "库存不足",
-          icon: "none",
+          title: '库存不足',
+          icon: 'none',
         });
         return;
       }
@@ -628,23 +638,23 @@ export default {
         if (this.quantity > this.productInfo.regiment_quota) {
           this.quantity = this.productInfo.regiment_quota;
           uni.showToast({
-            title: "拼团限购" + this.productInfo.regiment_quota + "份",
-            icon: "none",
+            title: '拼团限购' + this.productInfo.regiment_quota + '份',
+            icon: 'none',
           });
           return;
         }
         const timestamp = Math.round(new Date().getTime() / 1000).toString();
         if (timestamp > this.productInfo.regiment_active.end_time) {
           uni.showToast({
-            title: "拼团活动已结束",
-            icon: "none",
+            title: '拼团活动已结束',
+            icon: 'none',
           });
           return;
         }
         if (this.specBtnType === 4 && timestamp > this.productInfo.automatic_info.end_time) {
           uni.showToast({
-            title: "该团已过期",
-            icon: "none",
+            title: '该团已过期',
+            icon: 'none',
           });
           return;
         }
@@ -681,7 +691,7 @@ export default {
         // 请求接口
         this.$http
           .request(
-            "api/orders/create_regiment",
+            'api/orders/create_regiment',
             {
               product_list: productList,
               // custom_coupon_id: this.customCoupon,
@@ -689,22 +699,30 @@ 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"
+            'post'
           )
           .then((re) => {
             // 判断结果
-            if (re.code == "success") {
+            if (re.code == 'success') {
               // 处理结果
               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,
@@ -716,27 +734,35 @@ export default {
         // 请求接口
         this.$http
           .request(
-            "api/orders/create",
+            'api/orders/create',
             {
               product_list: productList,
               custom_coupon_id: this.customCoupon,
               addr_id: this.checkedAddr.id,
+              is_pay: this.is_pay,
             },
-            "post"
+            'post'
           )
           .then((re) => {
             // 判断结果
-            if (re.code == "success") {
+            if (re.code == 'success') {
               // 处理结果
               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,
@@ -760,23 +786,23 @@ export default {
           skuname.push(this.productInfo.product_attr[i].spec_name);
         }
         uni.showToast({
-          title: "请选择" + skuname.join(" 与 "),
-          icon: "none",
+          title: '请选择' + skuname.join(' 与 '),
+          icon: 'none',
         });
         return;
       }
       // 下单数量小于0
       if (this.quantity < 1) {
         uni.showToast({
-          title: "至少购买1个",
+          title: '至少购买1个',
         });
         return;
       }
       // 如果库存不足
       if (this.productInfo.stock < 1) {
         uni.showToast({
-          title: "库存不足",
-          icon: "none",
+          title: '库存不足',
+          icon: 'none',
         });
         return;
       }
@@ -784,8 +810,8 @@ export default {
       if (this.productInfo.stock < this.quantity) {
         this.quantity = this.productInfo.stock;
         uni.showToast({
-          title: "库存不足",
-          icon: "none",
+          title: '库存不足',
+          icon: 'none',
         });
         return;
       }
@@ -796,21 +822,21 @@ export default {
         skuid: this.sku_id,
       };
       // 请求接口
-      this.$http.request("api/shop_cart/add", data, "post").then((re) => {
+      this.$http.request('api/shop_cart/add', data, 'post').then((re) => {
         // 判断结果
-        if (re.code == "success") {
+        if (re.code == 'success') {
           // 跳转到订单列表
           uni.showToast({
-            icon: "success",
-            title: "加入购物车成功",
+            icon: 'success',
+            title: '加入购物车成功',
           });
           // 关闭结果
           this.$refs.specPopup.close();
         } else {
           // 跳转到订单列表
           uni.showToast({
-            icon: "error",
-            title: "加入购物车失败",
+            icon: 'error',
+            title: '加入购物车失败',
           });
         }
       });
@@ -906,7 +932,7 @@ export default {
         if (index != i) this.couponList[i].checked = 0;
       }
       // 如果未选中,提示可用
-      if (!this.couponList[index].checked) this.couponUsed = "去使用 >";
+      if (!this.couponList[index].checked) this.couponUsed = '去使用 >';
       // 已经选择的优惠券ID
       this.customCoupon = this.couponList[index].checked ? this.couponList[index].id : 0;
       // 计算扣减
@@ -979,7 +1005,7 @@ export default {
             // 计算扣减数据
             rebatePrice = this.$decimal.mul(this.couponList[i].rebate, 1);
             // 替换文字
-            this.couponUsed = "¥-" + rebatePrice.toFixed(2);
+            this.couponUsed = '¥-' + rebatePrice.toFixed(2);
           }
           // 折扣
           if (this.couponList[i].rebate_type == 2) {
@@ -988,12 +1014,12 @@ export default {
             // 减数
             rebatePrice = this.$decimal.sub(totalPrice, rebatePrice.mul(0.1));
             // 替换文字
-            this.couponUsed = "¥-" + rebatePrice.toFixed(2);
+            this.couponUsed = '¥-' + rebatePrice.toFixed(2);
           }
           //  赠品
           if (this.couponList[i].rebate_type == 3) {
             // 替换文字
-            this.couponUsed = "送" + (this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name : "");
+            this.couponUsed = '送' + (this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name : '');
           }
           // 小数点保留
           this.rebatePrice = rebatePrice.toFixed(2);
@@ -1011,9 +1037,9 @@ export default {
     },
     getAddrList() {
       // 判断数据
-      this.$http.request("api/custom_addr/get_list").then((callback) => {
+      this.$http.request('api/custom_addr/get_list').then((callback) => {
         // 获取成功
-        if (callback.code == "success") {
+        if (callback.code == 'success') {
           this.addrList = callback.data;
           // 如果有的话
           if (this.addrList.length) {
@@ -1037,7 +1063,7 @@ export default {
       // 返回结果
       this.follow_linkurl = this.$checkAccess.getFollowLinkUrl();
       // 有图才展示
-      if (this.followQrcode) this.$refs.addFollow.open("center");
+      if (this.followQrcode) this.$refs.addFollow.open('center');
     },
     closeAddFollow() {
       this.$refs.addFollow.close();
@@ -1071,7 +1097,7 @@ export default {
         }
       }
       // 转成字符串
-      var attrids = attr_ids.join(",");
+      var attrids = attr_ids.join(',');
       // 如果选项不足的话
       if (attr_ids.length != this.productInfo.product_attr.length) return;
       // 如果当前点击的属性对应的SKU状态为未下架(初始化为0)
@@ -1091,8 +1117,8 @@ export default {
           // 如果商品已经下架(status等于1),则恢复当前规格下所有属性原来的active状态
           if (currentSKUStatus === 1) {
             uni.showToast({
-              title: "该规格已下架",
-              icon: "none",
+              title: '该规格已下架',
+              icon: 'none',
             });
             for (let k in originalActiveStates) {
               this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
@@ -1102,8 +1128,8 @@ export default {
           // 如果商品没有库存
           if (this.productInfo.product_sku[i].stock <= 0) {
             uni.showToast({
-              title: "该规格库存不足",
-              icon: "none",
+              title: '该规格库存不足',
+              icon: 'none',
             });
             for (let k in originalActiveStates) {
               this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
@@ -1134,8 +1160,8 @@ export default {
         // 如果没有对应的SKU
         if (!haveSku) {
           uni.showToast({
-            title: "该规格已下架",
-            icon: "none",
+            title: '该规格已下架',
+            icon: 'none',
           });
           for (let k in originalActiveStates) {
             this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
@@ -1148,17 +1174,17 @@ export default {
       if (this.productInfo.product_sku.length) {
         if (this.productInfo.product_sku[0].status === 1) {
           uni.showToast({
-            title: "该规格已下架",
-            icon: "none",
+            title: '该规格已下架',
+            icon: 'none',
           });
           this.productInfo.stock = 0;
-          var attr_ids = this.productInfo.product_sku[0].attr_ids.split(",");
+          var attr_ids = this.productInfo.product_sku[0].attr_ids.split(',');
           // 循环规格列表
           for (let i in this.productInfo.product_attr) {
             // 再循环属性
             for (let j in this.productInfo.product_attr[i].attr_list) {
               // 如果不等于id
-              if (attr_ids.includes(this.productInfo.product_attr[i].attr_list[j].id + "")) {
+              if (attr_ids.includes(this.productInfo.product_attr[i].attr_list[j].id + '')) {
                 // 取消选中
                 this.productInfo.product_attr[i].attr_list[j].active = 0;
               }
@@ -1171,17 +1197,17 @@ export default {
     // 去往webview
     followLinkurl() {
       // 获取登录标识
-      let userInfo = uni.getStorageSync("userInfo");
+      let userInfo = uni.getStorageSync('userInfo');
       // 如果不存在的话
-      if (!userInfo) return "";
+      if (!userInfo) return '';
       // 未添加好友
-      if (!userInfo.follow_linkurl) return "";
+      if (!userInfo.follow_linkurl) return '';
       // 获取Url
       let url = userInfo.follow_linkurl;
       // 没有路径,不跳转
       if (!url) return;
       // 判断是不是小程序链接
-      if (url.includes("http")) {
+      if (url.includes('http')) {
         // 转码
         let link_url = encodeURIComponent(url);
         // 跳转到webview
@@ -1413,11 +1439,11 @@ export default {
     border-top-left-radius: 20rpx;
     border-bottom-left-radius: 20rpx;
   }
-  
-  .show_car.hide_orderbtn{
-	  width: 580rpx;
-	  border-radius: 20rpx;
-	  margin-right: 35rpx;
+
+  .show_car.hide_orderbtn {
+    width: 580rpx;
+    border-radius: 20rpx;
+    margin-right: 35rpx;
   }
 
   .to_car {

+ 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,
 };